packaging overhaul (closes #298406)

  • rename everything from logilab.packaging.* to just lgp
  • use standard setuptools
authorJulien Cristau <julien.cristau@logilab.fr>
changeset976447b86ca4
branchdefault
phasepublic
hiddenno
parent revision#9ba15c4c92d1 add GPL text
child revision#3a6a203e6267 [debian] update debian package for source changes (related to #298406)
files modified by this revision
MANIFEST.in
__init__.py
__pkginfo__.py
bin/lgp
debian/control
lgp/__init__.py
lgp/build.py
lgp/check.py
lgp/clean.py
lgp/lib/__init__.py
lgp/lib/changelog.py
lgp/lib/manifest.py
lgp/lib/pkginfo.py
lgp/lib/utils.py
lgp/setup.py
lgp/setupinfo.py
lgp/shell.py
lgp/tag.py
lgp/utils.py
lib/__init__.py
lib/changelog.py
lib/manifest.py
lib/pkginfo.py
lib/utils.py
setup.py
test/unittest_architecture.py
test/unittest_build.py
test/unittest_changelog.py
test/unittest_distributions.py
test/unittest_lgputils.py
test/unittest_manifest.py
test/unittest_pkginfo.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1432733058 -7200
# Wed May 27 15:24:18 2015 +0200
# Node ID 976447b86ca49fbd7a795821906a625058d7e4fa
# Parent 9ba15c4c92d162a07ea7574ccb62e38c10841d31
packaging overhaul (closes #298406)

- rename everything from logilab.packaging.* to just lgp
- use standard setuptools

diff --git a/MANIFEST.in b/MANIFEST.in
@@ -4,16 +4,14 @@
1  include bin/lgp
2 
3  include doc/*.txt
4  include doc/makefile
5  recursive-include doc *.rst
6 -recursive-include templates *.txt *.py
7 
8  recursive-include test/data *
9 
10  include README
11 -include INSTALL
12  include COPYING
13  include ChangeLog
14  include logging.conf
15  include doc/*.html
16 
diff --git a/__init__.py b/__init__.py
@@ -1,3 +0,0 @@
17 -"""Logilab's development tools"""
18 -
19 -BASE_EXCLUDE = ('CVS', '.svn', '.hg', 'bzr', '.git')
diff --git a/__pkginfo__.py b/__pkginfo__.py
@@ -26,17 +26,28 @@
20 
21  description = "tools used at Logilab to create debian packages"
22  web = "http://www.logilab.org/project/logilab-packaging"
23  mailinglist = "mailto://python-projects@lists.logilab.org"
24 
25 -subpackage_of = 'logilab'
26 -
27 -from os.path import join, isdir
28 -
29 -include_dirs = ['templates', join('test', 'data')]
30 -
31  scripts = [
32      'bin/lgp',
33      ]
34 
35 +from os.path import join, isdir, dirname
36 +from os import listdir
37 +
38 +if '__file__' in locals():
39 +    here = dirname(__file__)
40 +else:
41 +    here = '.'
42 +
43 +def listfiles(path):
44 +    return [join(here, path, x) for x in listdir(join(here, path))
45 +            if not isdir(join(here, path, x))]
46 +
47 +data_files = [('etc/lgp', listfiles('etc/lgp')),
48 +              ('etc/lgp/hooks', listfiles('etc/lgp/hooks')),
49 +              ('etc/lgp/scripts', listfiles('etc/lgp/scripts')),
50 +              ]
51 +
52  # python-debian needs chardet but doesn't seem to declare the dependency
53 -install_requires = ['logilab-common', 'python-debian', 'chardet']
54 +install_requires = ['setuptools', 'logilab-common', 'python-debian', 'chardet']
diff --git a/bin/lgp b/bin/lgp
@@ -1,5 +1,5 @@
55  #!/usr/bin/env python
56  import sys
57  # wildcard import for auto-registration of the public lgp commands
58 -from logilab.packaging.lgp import *
59 +from lgp import *
60  LGP.run(sys.argv[1:])
diff --git a/debian/control b/debian/control
@@ -6,41 +6,45 @@
61             Julien Cristau <jcristau@debian.org>
62  Standards-Version: 3.9.4
63  Build-Depends: debhelper (>= 9), python-all (>= 2.6.5)
64  X-Python-Version: >= 2.6
65  Homepage: http://www.logilab.org/project/logilab-packaging
66 -Vcs-hg: http://hg.logilab.org/logilab/packaging
67 +Vcs-Hg: http://hg.logilab.org/logilab/packaging
68  Vcs-Browser: http://hg.logilab.org/logilab/packaging
69 
70 -Package: python-logilab-packaging
71 +Package: python-lgp
72  Architecture: all
73 -Depends: ${misc:Depends},
74 -	 ${python:Depends},
75 -	 python-debian,
76 -         python-logilab-common,
77 -	 python-apt,
78 +Depends:
79 + ${misc:Depends},
80 + ${python:Depends},
81 + python-debian,
82 + python-logilab-common,
83 + python-apt,
84  Description: python modules used at Logilab to ease Debian packaging
85 - .
86 - This package contains utility python modules for manipulate packaging files 
87 - (manifest, pkginfo, etc.), used by logilab-lgp  
88 + This package contains utility python modules to manipulate packaging files 
89 + (manifest, pkginfo, etc.), used by logilab-lgp.
90 
91  Package: logilab-lgp
92  Architecture: all
93 -Recommends: mercurial (>= 0.9.3), debinstall, diffstat
94 -Depends: ${misc:Depends},
95 -	 ${python:Depends},
96 -	 python-debian,
97 -	 lintian,
98 -	 pbuilder,
99 -	 devscripts,
100 -	 debhelper,
101 -	 python-logilab-common,
102 -	 sudo,
103 -	 debootstrap,
104 -	 python-apt,
105 -	 python-logilab-packaging
106 -Suggests: mock
107 +Depends:
108 + ${misc:Depends},
109 + ${python:Depends},
110 + python-debian,
111 + lintian,
112 + pbuilder,
113 + devscripts,
114 + debhelper,
115 + python-logilab-common,
116 + sudo,
117 + debootstrap,
118 + python-apt,
119 + python-lgp,
120 +Suggests:
121 + mock,
122 + debinstall,
123 + mercurial (>= 0.9.3),
124 + diffstat,
125  Breaks: python-logilab-devtools (<< 0.23),
126  Conflicts:
127   logilab-packaging,
128  Replaces:
129   python-logilab-devtools (<< 0.23),
@@ -53,6 +57,5 @@
130   (with a rough support for rpm packages).
131   .
132   lgp is mainly a wrapper around puilder that ease the creation of chroot-based
133   environment in which lgp can build debian packages targeting several Debian or
134   Ubuntu distributions.
135 -
diff --git a/lgp/__init__.py b/lgp/__init__.py
@@ -16,16 +16,25 @@
136  # this program; if not, write to the Free Software Foundation, Inc.,
137  # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
138 
139  import sys
140  import logging
141 +import pkg_resources
142 
143  import logilab.common.clcommands as cli
144 
145 -from logilab.packaging.__pkginfo__ import description, version
146 -from logilab.packaging.lgp.exceptions import LGPException
147 +from lgp.exceptions import LGPException
148 
149 +pkg = pkg_resources.get_distribution('logilab-packaging')
150 +__version__ = version = pkg.version
151 +
152 +def _get_description(pkginfo):
153 +    # I know, right?
154 +    from email import message_from_string
155 +    msg = message_from_string(pkginfo)
156 +    return msg['Summary']
157 +description = _get_description(pkg.get_metadata('PKG-INFO'))
158 
159  LGP_CONFIG_FILE = '/etc/lgp/lgprc'
160  LGP_SUITES      = '/usr/share/debootstrap/scripts/'
161  CONFIG_FILE     = '/etc/lgp/pbuilderrc'
162  HOOKS_DIR       = '/var/lib/logilab-packaging/hooks'
@@ -53,7 +62,8 @@
163 
164 
165  LGP = LGPCommandLine('lgp', doc=description, rcfile=LGP_CONFIG_FILE,
166                       version=version, logthreshold=logging.INFO)
167 
168 +BASE_EXCLUDE = ('CVS', '.svn', '.hg', 'bzr', '.git')
169 
170 -__all__ = ['LGP', 'clean', 'build', 'check', 'tag', 'setup', 'shell']
171 +__all__ = ['LGP', 'clean', 'build', 'check', 'tag', 'setup', 'shell', 'BASE_EXCLUDE']
diff --git a/lgp/build.py b/lgp/build.py
@@ -30,17 +30,17 @@
172  from debian import deb822
173 
174  from logilab.common.shellutils import cp
175  from logilab.common.fileutils import export
176 
177 -from logilab.packaging.lgp import LGP, CONFIG_FILE, HOOKS_DIR, utils
178 -from logilab.packaging.lgp.exceptions import (LGPException, LGPCommandException)
179 -from logilab.packaging.lgp.utils import tempdir
180 +from lgp import LGP, CONFIG_FILE, HOOKS_DIR, utils
181 +from lgp.exceptions import (LGPException, LGPCommandException)
182 +from lgp.utils import tempdir
183 
184 -from logilab.packaging.lgp.check import check_debsign
185 -from logilab.packaging.lgp.setupinfo import SetupInfo
186 -from logilab.packaging.lgp.clean import Cleaner
187 +from lgp.check import check_debsign
188 +from lgp.setupinfo import SetupInfo
189 +from lgp.clean import Cleaner
190 
191 
192  @LGP.register
193  class Builder(SetupInfo):
194      """Build a debian package.
diff --git a/lgp/check.py b/lgp/check.py
@@ -25,16 +25,16 @@
195  import itertools
196  import subprocess
197  from os.path import basename, join, exists, isdir, isfile
198  from glob import glob
199 
200 -from logilab.packaging import BASE_EXCLUDE, __path__
201 -from logilab.packaging.lgp import LGP, LGP_CONFIG_FILE, utils
202 -from logilab.packaging.lgp.setupinfo import SetupInfo
203 -from logilab.packaging.lgp.exceptions import LGPException
204 -from logilab.packaging.lib.changelog import CHANGEFILE
205 -from logilab.packaging.lib.manifest import (get_manifest_files, read_manifest_in,
206 +from lgp import BASE_EXCLUDE, __path__
207 +from lgp import LGP, LGP_CONFIG_FILE, utils
208 +from lgp.setupinfo import SetupInfo
209 +from lgp.exceptions import LGPException
210 +from lgp.lib.changelog import CHANGEFILE
211 +from lgp.lib.manifest import (get_manifest_files, read_manifest_in,
212                                             match_extensions, JUNK_EXTENSIONS)
213 
214 
215  OK, NOK = 1, 0
216  CHECKS = {'debian'    : set(['debian_dir', 'debian_rules', 'debian_copying',
@@ -550,11 +550,11 @@
217              checker.logger.warn('command "python __pkginfo__.py" returns errors')
218      else:
219          return status
220 
221      # check mandatory attributes defined by pkginfo policy
222 -    from logilab.packaging.lib.pkginfo import check_info_module
223 +    from lgp.lib.pkginfo import check_info_module
224      class Reporter(object):
225          def warning(self, path, line, msg):
226              checker.logger.warn(msg)
227          def error(self, path, line, msg):
228              checker.logger.error(msg)
diff --git a/lgp/clean.py b/lgp/clean.py
@@ -16,12 +16,12 @@
229  # this program; if not, write to the Free Software Foundation, Inc.,
230  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
231 
232  import os
233 
234 -from logilab.packaging.lgp import LGP
235 -from logilab.packaging.lgp.setupinfo import SetupInfo
236 +from lgp import LGP
237 +from lgp.setupinfo import SetupInfo
238 
239 
240  @LGP.register
241  class Cleaner(SetupInfo):
242      """Clean the project directory.
diff --git a/lib/__init__.py b/lgp/lib/__init__.py
diff --git a/lib/changelog.py b/lgp/lib/changelog.py
diff --git a/lib/manifest.py b/lgp/lib/manifest.py
@@ -23,11 +23,11 @@
243  from distutils.filelist import FileList
244  from distutils.text_file import TextFile
245  from distutils.errors import DistutilsTemplateError
246  import distutils
247 
248 -from logilab.packaging import BASE_EXCLUDE
249 +from lgp import BASE_EXCLUDE
250 
251  JUNK_EXTENSIONS = ('~', '.pyc', '.pyo', '.fo', '.o', '.so', '.swp', '.orig')
252 
253  def match_extensions(filename, extensions):
254      """return true if the given file match one of the given extensions"""
diff --git a/lib/pkginfo.py b/lgp/lib/pkginfo.py
@@ -30,14 +30,14 @@
255 
256  from logilab.common.fileutils import lines, ensure_fs_mode
257  from logilab.common.shellutils import find
258  from logilab.common.deprecation import deprecated
259 
260 -import logilab.packaging
261 -from logilab.packaging.lib import TextReporter
262 -from logilab.packaging.lib.utils import SGMLCatalog, get_scripts, glob_match
263 -from logilab.packaging import BASE_EXCLUDE
264 +import lgp
265 +from lgp.lib import TextReporter
266 +from lgp.lib.utils import SGMLCatalog, get_scripts, glob_match
267 +from lgp import BASE_EXCLUDE
268 
269  try:
270      from scriptfoundry.snakespell import iSpell
271      def spell_check(text, dictionary='american', ignore=()):
272          """spell the given text and return a list of possibly misspelled words
@@ -50,12 +50,10 @@
273      def spell_check(text, dictionary=None, ignore=()):
274          """spell the given text and return a list of possibly misspelled words
275          """
276          return []
277 
278 -TEMPLATE_DIR = join(logilab.packaging.__path__[0], 'templates')
279 -
280  STD_DOCS = ('README', 'README.txt', 'ChangeLog',
281              'TODO', 'TODO.txt',
282              'INSTALL', 'INSTALL.txt')
283  SPEC_FILES = ('MANIFEST.in', 'setup.py', 'setup.cfg',
284                'AUTHORS', 'DEPENDS', 'RECOMMENDS', 'SUGGESTS') + STD_DOCS
@@ -449,17 +447,10 @@
285          """
286          if name == 'numversion':
287              setattr(self, 'version', '.'.join([str(word) for word in value]))
288          elif name == 'version':
289              setattr(self, 'numversion', value.split('.'))
290 -        elif name == 'license' and value is not None:
291 -            try:
292 -                self.setattr('license_text', get_license_text(value))
293 -            except KeyError:
294 -                msg = 'unknown license %s' % value
295 -                self.setattr('license_text', '')
296 -                self.reporter.warning(self.info_module, None, msg)
297          elif name == 'short_desc':
298              name = 'description'
299          setattr(self, name, value)
300 
301      def init_from_module(self):
diff --git a/lib/utils.py b/lgp/lib/utils.py
@@ -19,11 +19,11 @@
302  import re
303  import os
304  import glob
305  from os.path import basename, join, split, exists
306 
307 -from logilab.packaging import BASE_EXCLUDE
308 +from lgp import BASE_EXCLUDE
309 
310  PUBLIC_RGX = re.compile('PUBLIC\s+"-//(?P<group>.*)//DTD (?P<pubid>.*)//(?P<lang>\w\w)(//XML)?"\s*"(?P<dtd>.*)"')
311 
312 
313  class SGMLCatalog:
diff --git a/lgp/setup.py b/lgp/setup.py
@@ -20,13 +20,13 @@
314  import os
315  import sys
316  import glob
317  from subprocess import check_call, CalledProcessError
318 
319 -from logilab.packaging.lgp import (LGP, CONFIG_FILE, HOOKS_DIR, utils)
320 -from logilab.packaging.lgp.setupinfo import SetupInfo
321 -from logilab.packaging.lgp.check import check_keyrings
322 +from lgp import (LGP, CONFIG_FILE, HOOKS_DIR, utils)
323 +from lgp.setupinfo import SetupInfo
324 +from lgp.check import check_keyrings
325 
326 
327  @LGP.register
328  class Setup(SetupInfo):
329      """Set up and manage build images.
diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
@@ -32,13 +32,13 @@
330  from logilab.common import clcommands
331  from logilab.common.logging_ext import ColorFormatter
332  from logilab.common.shellutils import cp
333  from logilab.common.decorators import cached
334 
335 -from logilab.packaging.lib.pkginfo import PackageInfo
336 -from logilab.packaging.lgp import LOG_FORMAT, utils
337 -from logilab.packaging.lgp.exceptions import LGPException, LGPCommandException
338 +from lgp.lib.pkginfo import PackageInfo
339 +from lgp import LOG_FORMAT, utils
340 +from lgp.exceptions import LGPException, LGPCommandException
341 
342  COMMANDS = {
343          'file': {
344              "sdist": '$setup dist-gzip -e DIST_DIR=$dist_dir',
345              "clean": '$setup clean',
@@ -239,11 +239,11 @@
346              self.logger.info('use specific setup file: %s', setup_file)
347 
348          if osp.isfile('__pkginfo__.py') and not setup_file:
349              # Logilab's specific format
350              # FIXME Format is buggy if setup_file was set to 'setup.py'
351 -            from logilab.packaging.lib import TextReporter
352 +            from lgp.lib import TextReporter
353              self.config._package = PackageInfo(reporter=TextReporter(file(os.devnull, "w+")),
354                                                 directory=self.config.pkg_dir)
355              assert osp.isfile('setup.py'), "setup.py is still mandatory"
356          # other script can be used if compatible with the expected targets in COMMANDS
357          elif osp.isfile(setup_file):
diff --git a/lgp/shell.py b/lgp/shell.py
@@ -19,12 +19,12 @@
358  import os
359  import sys
360  import glob
361  from subprocess import check_call, CalledProcessError
362 
363 -from logilab.packaging.lgp import LGP, CONFIG_FILE, HOOKS_DIR, SCRIPTS_DIR
364 -from logilab.packaging.lgp.setupinfo import SetupInfo
365 +from lgp import LGP, CONFIG_FILE, HOOKS_DIR, SCRIPTS_DIR
366 +from lgp.setupinfo import SetupInfo
367 
368  @LGP.register
369  class Shell(SetupInfo):
370      """Run a script or interactive shell in a chrooted distribution"""
371 
diff --git a/lgp/tag.py b/lgp/tag.py
@@ -19,13 +19,13 @@
372  import os, os.path as osp
373  import ConfigParser
374  from string import Template
375  from subprocess import check_call
376 
377 -from logilab.packaging.lgp import LGP, LGP_CONFIG_FILE
378 -from logilab.packaging.lgp.setupinfo import SetupInfo
379 -from logilab.packaging.lgp.exceptions import LGPException
380 +from lgp import LGP, LGP_CONFIG_FILE
381 +from lgp.setupinfo import SetupInfo
382 +from lgp.exceptions import LGPException
383 
384 
385  @LGP.register
386  class Tagger(SetupInfo):
387      """Tag the project source repository.
diff --git a/lgp/utils.py b/lgp/utils.py
@@ -27,12 +27,12 @@
388  import logging
389 
390  from debian.deb822 import Deb822
391  from debian.changelog import Changelog, ChangelogParseError
392 
393 -from logilab.packaging.lgp import LGP_SUITES
394 -from logilab.packaging.lgp.exceptions import (ArchitectureException,
395 +from lgp import LGP_SUITES
396 +from lgp.exceptions import (ArchitectureException,
397                                                DistributionException,
398                                                SetupException,
399                                                LGPException)
400 
401 
diff --git a/setup.py b/setup.py
@@ -19,185 +19,56 @@
402  # with logilab-packaging.  If not, see <http://www.gnu.org/licenses/>.
403  """Generic Setup script, takes package info from __pkginfo__.py file.
404  """
405  __docformat__ = "restructuredtext en"
406 
407 -import os
408 -import sys
409 -import shutil
410 -from os.path import isdir, exists, join, walk
411 -
412 -try:
413 -    if os.environ.get('NO_SETUPTOOLS'):
414 -        raise ImportError()
415 -    from setuptools import setup
416 -    from setuptools.command import install_lib
417 -    USE_SETUPTOOLS = 1
418 -except ImportError:
419 -    from distutils.core import setup
420 -    from distutils.command import install_lib
421 -    USE_SETUPTOOLS = 0
422 -
423 -
424 -sys.modules.pop('__pkginfo__', None)
425 -# import required features
426 -from __pkginfo__ import modname, version, license, description, \
427 -     web, author, author_email
428 -# import optional features
429 -import __pkginfo__
430 -distname = getattr(__pkginfo__, 'distname', modname)
431 -scripts = getattr(__pkginfo__, 'scripts', [])
432 -data_files = getattr(__pkginfo__, 'data_files', None)
433 -subpackage_of = getattr(__pkginfo__, 'subpackage_of', None)
434 -include_dirs = getattr(__pkginfo__, 'include_dirs', [])
435 -ext_modules = getattr(__pkginfo__, 'ext_modules', None)
436 -install_requires = getattr(__pkginfo__, 'install_requires', None)
437 -dependency_links = getattr(__pkginfo__, 'dependency_links', [])
438 -py_modules = getattr(__pkginfo__, 'py_modules', [])
439 -
440 -STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
441 -
442 -IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~')
443 -
444 -if exists('README'):
445 -    long_description = file('README').read()
446 -else:
447 -    long_description = ''
448 -
449 -def ensure_scripts(linux_scripts):
450 -    """Creates the proper script names required for each platform
451 -    (taken from 4Suite)
452 -    """
453 -    from distutils import util
454 -    if util.get_platform()[:3] == 'win':
455 -        scripts_ = [script + '.bat' for script in linux_scripts]
456 -    else:
457 -        scripts_ = linux_scripts
458 -    return scripts_
459 -
460 -def get_packages(directory, prefix):
461 -    """return a list of subpackages for the given directory"""
462 -    result = []
463 -    for package in os.listdir(directory):
464 -        absfile = join(directory, package)
465 -        if isdir(absfile):
466 -            if exists(join(absfile, '__init__.py')) or \
467 -                   package in ('test', 'tests'):
468 -                if prefix:
469 -                    result.append('%s.%s' % (prefix, package))
470 -                else:
471 -                    result.append(package)
472 -                result += get_packages(absfile, result[-1])
473 -    return result
474 +from setuptools import setup, find_packages
475 +from io import open
476 +from os import path
477 
478 -def export(from_dir, to_dir,
479 -           blacklist=STD_BLACKLIST,
480 -           ignore_ext=IGNORED_EXTENSIONS,
481 -           verbose=True):
482 -    """make a mirror of from_dir in to_dir, omitting directories and files
483 -    listed in the black list
484 -    """
485 -    def make_mirror(arg, directory, fnames):
486 -        """walk handler"""
487 -        for norecurs in blacklist:
488 -            try:
489 -                fnames.remove(norecurs)
490 -            except ValueError:
491 -                pass
492 -        for filename in fnames:
493 -            # don't include binary files
494 -            if filename[-4:] in ignore_ext:
495 -                continue
496 -            if filename[-1] == '~':
497 -                continue
498 -            src = join(directory, filename)
499 -            dest = to_dir + src[len(from_dir):]
500 -            if verbose:
501 -                print >> sys.stderr, src, '->', dest
502 -            if os.path.isdir(src):
503 -                if not exists(dest):
504 -                    os.mkdir(dest)
505 -            else:
506 -                if exists(dest):
507 -                    os.remove(dest)
508 -                shutil.copy2(src, dest)
509 -    try:
510 -        os.mkdir(to_dir)
511 -    except OSError, ex:
512 -        # file exists ?
513 -        import errno
514 -        if ex.errno != errno.EEXIST:
515 -            raise
516 -    walk(from_dir, make_mirror, None)
517 -
518 -
519 -EMPTY_FILE = '''"""generated file, don\'t modify or your data will be lost"""
520 -try:
521 -    __import__('pkg_resources').declare_namespace(__name__)
522 -except ImportError:
523 -    pass
524 -'''
525 +here = path.abspath(path.dirname(__file__))
526 
527 -class MyInstallLib(install_lib.install_lib):
528 -    """extend install_lib command to handle  package __init__.py and
529 -    include_dirs variable if necessary
530 -    """
531 -    def run(self):
532 -        """overridden from install_lib class"""
533 -        install_lib.install_lib.run(self)
534 -        # create Products.__init__.py if needed
535 -        if subpackage_of:
536 -            product_init = join(self.install_dir, subpackage_of, '__init__.py')
537 -            if not exists(product_init):
538 -                self.announce('creating %s' % product_init)
539 -                stream = open(product_init, 'w')
540 -                stream.write(EMPTY_FILE)
541 -                stream.close()
542 -        # manually install included directories if any
543 -        if include_dirs:
544 -            if subpackage_of:
545 -                base = join(subpackage_of, modname)
546 -            else:
547 -                base = modname
548 -            for directory in include_dirs:
549 -                dest = join(self.install_dir, base, directory)
550 -                export(directory, dest, verbose=False)
551 +pkginfo = {}
552 +with open(path.join(here, '__pkginfo__.py')) as f:
553 +    exec(f.read(), pkginfo)
554 
555 -def install(**kwargs):
556 -    """setup entry point"""
557 -    if USE_SETUPTOOLS:
558 -        if '--force-manifest' in sys.argv:
559 -            sys.argv.remove('--force-manifest')
560 -    # install-layout option was introduced in 2.5.3-1~exp1
561 -    elif sys.version_info < (2, 5, 4) and '--install-layout=deb' in sys.argv:
562 -        sys.argv.remove('--install-layout=deb')
563 -    if subpackage_of:
564 -        package = subpackage_of + '.' + modname
565 -        kwargs['package_dir'] = {package : '.'}
566 -        packages = [package] + get_packages(os.getcwd(), package)
567 -        if USE_SETUPTOOLS:
568 -            kwargs['namespace_packages'] = [subpackage_of]
569 -    else:
570 -        kwargs['package_dir'] = {modname : '.'}
571 -        packages = [modname] + get_packages(os.getcwd(), modname)
572 -    if USE_SETUPTOOLS and install_requires:
573 -        kwargs['install_requires'] = install_requires
574 -        kwargs['dependency_links'] = dependency_links
575 -    kwargs['packages'] = packages
576 -    return setup(name = distname,
577 -                 version = version,
578 -                 license = license,
579 -                 description = description,
580 -                 long_description = long_description,
581 -                 author = author,
582 -                 author_email = author_email,
583 -                 url = web,
584 -                 scripts = ensure_scripts(scripts),
585 -                 data_files = data_files,
586 -                 ext_modules = ext_modules,
587 -                 py_modules=py_modules,
588 -                 cmdclass = {'install_lib': MyInstallLib},
589 -                 **kwargs
590 -                 )
591 +with open(path.join(here, 'README'), encoding='utf-8') as f:
592 +    long_description = f.read()
593 
594 -if __name__ == '__main__' :
595 -    install()
596 +setup(
597 +    name=pkginfo['distname'],
598 +    version=pkginfo['version'],
599 +    description=pkginfo['description'],
600 +    long_description=long_description,
601 +    url=pkginfo['web'],
602 +    author=pkginfo['author'],
603 +    author_email=pkginfo['author_email'],
604 +    license=pkginfo['license'],
605 +
606 +    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
607 +    classifiers=[
608 +        # How mature is this project? Common values are
609 +        #   3 - Alpha
610 +        #   4 - Beta
611 +        #   5 - Production/Stable
612 +        'Development Status :: 3 - Alpha',
613 +
614 +        # Indicate who your project is intended for
615 +        'Intended Audience :: Developers',
616 +        'Topic :: Software Development :: Build Tools',
617 +
618 +        # Pick your license as you wish (should match "license" above)
619 +        'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
620 +
621 +        # Specify the Python versions you support here. In particular, ensure
622 +        # that you indicate whether you support Python 2, Python 3 or both.
623 +        'Programming Language :: Python :: 2',
624 +        'Programming Language :: Python :: 2.6',
625 +        'Programming Language :: Python :: 2.7',
626 +    ],
627 +
628 +    packages=find_packages(exclude=['contrib', 'docs', 'test*']),
629 +    install_requires=pkginfo['install_requires'],
630 +    scripts=pkginfo['scripts'],
631 +    data_files = pkginfo['data_files'],
632 +
633 +)
diff --git a/test/unittest_architecture.py b/test/unittest_architecture.py
@@ -1,12 +1,12 @@
634  from __future__ import with_statement
635 
636  from subprocess import Popen, PIPE
637 
638  from logilab.common.testlib import TestCase, unittest_main
639 -from logilab.packaging.lgp.utils import get_architectures
640 -from logilab.packaging.lgp.exceptions import ArchitectureException
641 +from lgp.utils import get_architectures
642 +from lgp.exceptions import ArchitectureException
643 
644 
645  class ArchitectureTC(TestCase):
646 
647      def test_default_architecture(self):
diff --git a/test/unittest_build.py b/test/unittest_build.py
@@ -6,15 +6,15 @@
648  import tempfile
649  import tarfile
650 
651  from logilab.common.testlib import TestCase, unittest_main, within_tempdir
652 
653 -from logilab.packaging.lgp.utils import tempdir
654 -from logilab.packaging.lgp.exceptions import LGPCommandException
655 -from logilab.packaging.lgp import build
656 +from lgp.utils import tempdir
657 +from lgp.exceptions import LGPCommandException
658 +from lgp import build
659 
660 -from logilab.packaging.lgp.check import check_debsign
661 +from lgp.check import check_debsign
662 
663 
664  class BuildTC(TestCase):
665 
666      def setUp(self):
diff --git a/test/unittest_changelog.py b/test/unittest_changelog.py
@@ -1,11 +1,11 @@
667  from os.path import join, dirname
668  from cStringIO import StringIO
669 
670  from logilab.common.testlib import TestCase, unittest_main
671 
672 -from logilab.packaging.lib.changelog import *
673 +from lgp.lib.changelog import *
674 
675 
676  class ChangeLogTC(TestCase):
677      cl_class = ChangeLog
678      cl_file = join(dirname(__file__), 'data', 'ChangeLog')
diff --git a/test/unittest_distributions.py b/test/unittest_distributions.py
@@ -1,10 +1,10 @@
679  import os.path
680 
681  from logilab.common.testlib import TestCase, unittest_main
682 -from logilab.packaging.lgp.utils import get_distributions
683 -from logilab.packaging.lgp.exceptions import DistributionException
684 +from lgp.utils import get_distributions
685 +from lgp.exceptions import DistributionException
686 
687 
688 
689  class DistributionTC(TestCase):
690 
diff --git a/test/unittest_lgputils.py b/test/unittest_lgputils.py
@@ -5,11 +5,11 @@
691  try:
692      from unittest2 import main, TestCase
693  except ImportError:
694      from unittest import main, TestCase
695 
696 -from logilab.packaging.lgp import utils
697 +from lgp import utils
698 
699  class UtilsTC(TestCase):
700      def test_tempdir_utility(self):
701          with self.assertRaises(AssertionError):
702              with utils.tempdir(False) as tmpdir:
diff --git a/test/unittest_manifest.py b/test/unittest_manifest.py
@@ -16,12 +16,12 @@
703 
704  import sys
705  from os.path import dirname, join
706  from logilab.common.testlib import TestCase, unittest_main
707 
708 -from logilab.packaging.lib.manifest import *
709 -from logilab.packaging.lib import TextReporter
710 +from lgp.lib.manifest import *
711 +from lgp.lib import TextReporter
712 
713  reporter = TextReporter()
714 
715  class MatchExtensionsFunctionTest(TestCase):
716 
diff --git a/test/unittest_pkginfo.py b/test/unittest_pkginfo.py
@@ -1,16 +1,14 @@
717  import os
718  from logilab.common.testlib import TestCase, unittest_main
719 -from logilab.packaging.lib import pkginfo, TextReporter
720 -
721 +from lgp.lib import pkginfo, TextReporter
722 
723  class PkgInfoProject(TestCase):
724 
725      def test_pkginfo_project_itself(self):
726 -        import logilab.packaging
727          self.assertEqual(pkginfo.check_info_module(TextReporter(),
728 -                                                    os.path.dirname(logilab.packaging.__file__)),
729 +                                                    os.path.dirname(os.path.dirname(__file__))),
730                                                      1)
731 
732 
733  if __name__ == '__main__':
734      unittest_main()