Move lgp back into the logilab namespace (closes #299294)

Turns out apycot has an lgp.py, where "from lgp import *" doesn't quite
do the right thing.

authorJulien Cristau <julien.cristau@logilab.fr>
changesetdee07eafe172
branchdefault
phasepublic
hiddenno
parent revision#0288dc5ea460 Added tag debian/1.2.0-2 for changeset 8abe76cf4a8b
child revision#8dc21c39f508 [debian] rename binary package to match module name
files modified by this revision
bin/lgp
debian/python-lgp.install
lgp/__init__.py
lgp/build.py
lgp/check.py
lgp/clean.py
lgp/exceptions.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
logilab/__init__.py
logilab/packaging/__init__.py
logilab/packaging/lgp/__init__.py
logilab/packaging/lgp/build.py
logilab/packaging/lgp/check.py
logilab/packaging/lgp/clean.py
logilab/packaging/lgp/exceptions.py
logilab/packaging/lgp/setup.py
logilab/packaging/lgp/setupinfo.py
logilab/packaging/lgp/shell.py
logilab/packaging/lgp/tag.py
logilab/packaging/lgp/utils.py
logilab/packaging/lib/__init__.py
logilab/packaging/lib/changelog.py
logilab/packaging/lib/manifest.py
logilab/packaging/lib/pkginfo.py
logilab/packaging/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 1438154947 -7200
# Wed Jul 29 09:29:07 2015 +0200
# Node ID dee07eafe17267cb4d41dcfcc5b87cf110486ec8
# Parent 0288dc5ea4606894057722a8c595e8d5048c9b08
Move lgp back into the logilab namespace (closes #299294)

Turns out apycot has an lgp.py, where "from lgp import *" doesn't quite
do the right thing.

diff --git a/bin/lgp b/bin/lgp
@@ -1,5 +1,5 @@
1  #!/usr/bin/env python
2  import sys
3  # wildcard import for auto-registration of the public lgp commands
4 -from lgp import *
5 +from logilab.packaging.lgp import *
6  LGP.run(sys.argv[1:])
diff --git a/debian/python-lgp.install b/debian/python-lgp.install
@@ -1,2 +1,2 @@
7 -usr/lib/python2*/*/lgp
8 +usr/lib/python2*/*/logilab/packaging
9  usr/lib/python2*/*/logilab_packaging-*.egg-info
diff --git a/logilab/__init__.py b/logilab/__init__.py
@@ -0,0 +1,1 @@
10 +__import__('pkg_resources').declare_namespace(__name__)
diff --git a/logilab/packaging/__init__.py b/logilab/packaging/__init__.py
diff --git a/lgp/__init__.py b/logilab/packaging/lgp/__init__.py
@@ -20,11 +20,11 @@
11  import logging
12  import pkg_resources
13 
14  import logilab.common.clcommands as cli
15 
16 -from lgp.exceptions import LGPException
17 +from logilab.packaging.lgp.exceptions import LGPException
18 
19  pkg = pkg_resources.get_distribution('logilab-packaging')
20  __version__ = version = pkg.version
21 
22  def _get_description(pkginfo):
diff --git a/lgp/build.py b/logilab/packaging/lgp/build.py
@@ -30,17 +30,17 @@
23  from debian import deb822
24 
25  from logilab.common.shellutils import cp
26  from logilab.common.fileutils import export
27 
28 -from lgp import LGP, CONFIG_FILE, HOOKS_DIR, utils
29 -from lgp.exceptions import (LGPException, LGPCommandException)
30 -from lgp.utils import tempdir
31 +from logilab.packaging.lgp import LGP, CONFIG_FILE, HOOKS_DIR, utils
32 +from logilab.packaging.lgp.exceptions import (LGPException, LGPCommandException)
33 +from logilab.packaging.lgp.utils import tempdir
34 
35 -from lgp.check import check_debsign
36 -from lgp.setupinfo import SetupInfo
37 -from lgp.clean import Cleaner
38 +from logilab.packaging.lgp.check import check_debsign
39 +from logilab.packaging.lgp.setupinfo import SetupInfo
40 +from logilab.packaging.lgp.clean import Cleaner
41 
42 
43  @LGP.register
44  class Builder(SetupInfo):
45      """Build a debian package.
diff --git a/lgp/check.py b/logilab/packaging/lgp/check.py
@@ -25,16 +25,16 @@
46  import itertools
47  import subprocess
48  from os.path import basename, join, exists, isdir, isfile
49  from glob import glob
50 
51 -from lgp import BASE_EXCLUDE, __path__
52 -from lgp import LGP, LGP_CONFIG_FILE, utils
53 -from lgp.setupinfo import SetupInfo
54 -from lgp.exceptions import LGPException
55 -from lgp.lib.changelog import CHANGEFILE
56 -from lgp.lib.manifest import (get_manifest_files, read_manifest_in,
57 +from logilab.packaging.lgp import BASE_EXCLUDE, __path__
58 +from logilab.packaging.lgp import LGP, LGP_CONFIG_FILE, utils
59 +from logilab.packaging.lgp.setupinfo import SetupInfo
60 +from logilab.packaging.lgp.exceptions import LGPException
61 +from logilab.packaging.lib.changelog import CHANGEFILE
62 +from logilab.packaging.lib.manifest import (get_manifest_files, read_manifest_in,
63                                             match_extensions, JUNK_EXTENSIONS)
64 
65 
66  OK, NOK = 1, 0
67  CHECKS = {'debian'    : set(['debian_dir', 'debian_rules', 'debian_copying',
@@ -550,11 +550,11 @@
68              checker.logger.warn('command "python __pkginfo__.py" returns errors')
69      else:
70          return status
71 
72      # check mandatory attributes defined by pkginfo policy
73 -    from lgp.lib.pkginfo import check_info_module
74 +    from logilab.packaging.lib.pkginfo import check_info_module
75      class Reporter(object):
76          def warning(self, path, line, msg):
77              checker.logger.warn(msg)
78          def error(self, path, line, msg):
79              checker.logger.error(msg)
diff --git a/lgp/clean.py b/logilab/packaging/lgp/clean.py
@@ -16,12 +16,12 @@
80  # this program; if not, write to the Free Software Foundation, Inc.,
81  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
82 
83  import os
84 
85 -from lgp import LGP
86 -from lgp.setupinfo import SetupInfo
87 +from logilab.packaging.lgp import LGP
88 +from logilab.packaging.lgp.setupinfo import SetupInfo
89 
90 
91  @LGP.register
92  class Cleaner(SetupInfo):
93      """Clean the project directory.
diff --git a/lgp/exceptions.py b/logilab/packaging/lgp/exceptions.py
diff --git a/lgp/setup.py b/logilab/packaging/lgp/setup.py
@@ -20,13 +20,13 @@
94  import os
95  import sys
96  import glob
97  from subprocess import check_call, CalledProcessError
98 
99 -from lgp import (LGP, CONFIG_FILE, HOOKS_DIR, utils)
100 -from lgp.setupinfo import SetupInfo
101 -from lgp.check import check_keyrings
102 +from logilab.packaging.lgp import (LGP, CONFIG_FILE, HOOKS_DIR, utils)
103 +from logilab.packaging.lgp.setupinfo import SetupInfo
104 +from logilab.packaging.lgp.check import check_keyrings
105 
106 
107  @LGP.register
108  class Setup(SetupInfo):
109      """Set up and manage build images.
diff --git a/lgp/setupinfo.py b/logilab/packaging/lgp/setupinfo.py
@@ -32,13 +32,13 @@
110  from logilab.common import clcommands
111  from logilab.common.logging_ext import ColorFormatter
112  from logilab.common.shellutils import cp
113  from logilab.common.decorators import cached
114 
115 -from lgp.lib.pkginfo import PackageInfo
116 -from lgp import LOG_FORMAT, utils
117 -from lgp.exceptions import LGPException, LGPCommandException
118 +from logilab.packaging.lib.pkginfo import PackageInfo
119 +from logilab.packaging.lgp import LOG_FORMAT, utils
120 +from logilab.packaging.lgp.exceptions import LGPException, LGPCommandException
121 
122  COMMANDS = {
123          'file': {
124              "sdist": '$setup dist-gzip -e DIST_DIR=$dist_dir',
125              "clean": '$setup clean',
@@ -239,11 +239,11 @@
126              self.logger.info('use specific setup file: %s', setup_file)
127 
128          if osp.isfile('__pkginfo__.py') and not setup_file:
129              # Logilab's specific format
130              # FIXME Format is buggy if setup_file was set to 'setup.py'
131 -            from lgp.lib import TextReporter
132 +            from logilab.packaging.lib import TextReporter
133              self.config._package = PackageInfo(reporter=TextReporter(file(os.devnull, "w+")),
134                                                 directory=self.config.pkg_dir)
135              assert osp.isfile('setup.py'), "setup.py is still mandatory"
136          # other script can be used if compatible with the expected targets in COMMANDS
137          elif osp.isfile(setup_file):
diff --git a/lgp/shell.py b/logilab/packaging/lgp/shell.py
@@ -19,12 +19,12 @@
138  import os
139  import sys
140  import glob
141  from subprocess import check_call, CalledProcessError
142 
143 -from lgp import LGP, CONFIG_FILE, HOOKS_DIR, SCRIPTS_DIR
144 -from lgp.setupinfo import SetupInfo
145 +from logilab.packaging.lgp import LGP, CONFIG_FILE, HOOKS_DIR, SCRIPTS_DIR
146 +from logilab.packaging.lgp.setupinfo import SetupInfo
147 
148  @LGP.register
149  class Shell(SetupInfo):
150      """Run a script or interactive shell in a chrooted distribution"""
151 
diff --git a/lgp/tag.py b/logilab/packaging/lgp/tag.py
@@ -19,13 +19,13 @@
152  import os, os.path as osp
153  import ConfigParser
154  from string import Template
155  from subprocess import check_call
156 
157 -from lgp import LGP, LGP_CONFIG_FILE
158 -from lgp.setupinfo import SetupInfo
159 -from lgp.exceptions import LGPException
160 +from logilab.packaging.lgp import LGP, LGP_CONFIG_FILE
161 +from logilab.packaging.lgp.setupinfo import SetupInfo
162 +from logilab.packaging.lgp.exceptions import LGPException
163 
164 
165  @LGP.register
166  class Tagger(SetupInfo):
167      """Tag the project source repository.
diff --git a/lgp/utils.py b/logilab/packaging/lgp/utils.py
@@ -27,12 +27,12 @@
168  import logging
169 
170  from debian.deb822 import Deb822
171  from debian.changelog import Changelog, ChangelogParseError
172 
173 -from lgp import LGP_SUITES
174 -from lgp.exceptions import (ArchitectureException,
175 +from logilab.packaging.lgp import LGP_SUITES
176 +from logilab.packaging.lgp.exceptions import (ArchitectureException,
177                                                DistributionException,
178                                                SetupException,
179                                                LGPException)
180 
181 
diff --git a/lgp/lib/__init__.py b/logilab/packaging/lib/__init__.py
diff --git a/lgp/lib/changelog.py b/logilab/packaging/lib/changelog.py
diff --git a/lgp/lib/manifest.py b/logilab/packaging/lib/manifest.py
@@ -23,11 +23,11 @@
182  from distutils.filelist import FileList
183  from distutils.text_file import TextFile
184  from distutils.errors import DistutilsTemplateError
185  import distutils
186 
187 -from lgp import BASE_EXCLUDE
188 +from logilab.packaging.lgp import BASE_EXCLUDE
189 
190  JUNK_EXTENSIONS = ('~', '.pyc', '.pyo', '.fo', '.o', '.so', '.swp', '.orig')
191 
192  def match_extensions(filename, extensions):
193      """return true if the given file match one of the given extensions"""
diff --git a/lgp/lib/pkginfo.py b/logilab/packaging/lib/pkginfo.py
@@ -30,14 +30,14 @@
194 
195  from logilab.common.fileutils import lines, ensure_fs_mode
196  from logilab.common.shellutils import find
197  from logilab.common.deprecation import deprecated
198 
199 -import lgp
200 -from lgp.lib import TextReporter
201 -from lgp.lib.utils import SGMLCatalog, get_scripts, glob_match
202 -from lgp import BASE_EXCLUDE
203 +import logilab.packaging.lgp
204 +from logilab.packaging.lib import TextReporter
205 +from logilab.packaging.lib.utils import SGMLCatalog, get_scripts, glob_match
206 +from logilab.packaging.lgp import BASE_EXCLUDE
207 
208  try:
209      from scriptfoundry.snakespell import iSpell
210      def spell_check(text, dictionary='american', ignore=()):
211          """spell the given text and return a list of possibly misspelled words
diff --git a/lgp/lib/utils.py b/logilab/packaging/lib/utils.py
@@ -19,11 +19,11 @@
212  import re
213  import os
214  import glob
215  from os.path import basename, join, split, exists
216 
217 -from lgp import BASE_EXCLUDE
218 +from logilab.packaging.lgp import BASE_EXCLUDE
219 
220  PUBLIC_RGX = re.compile('PUBLIC\s+"-//(?P<group>.*)//DTD (?P<pubid>.*)//(?P<lang>\w\w)(//XML)?"\s*"(?P<dtd>.*)"')
221 
222 
223  class SGMLCatalog:
diff --git a/setup.py b/setup.py
@@ -68,7 +68,7 @@
224 
225      packages=find_packages(exclude=['contrib', 'docs', 'test*']),
226      install_requires=pkginfo['install_requires'],
227      scripts=pkginfo['scripts'],
228      data_files = pkginfo['data_files'],
229 -
230 +    namespace_packages=['logilab'],
231  )
diff --git a/test/unittest_architecture.py b/test/unittest_architecture.py
@@ -1,12 +1,12 @@
232  from __future__ import with_statement
233 
234  from subprocess import Popen, PIPE
235 
236  from logilab.common.testlib import TestCase, unittest_main
237 -from lgp.utils import get_architectures
238 -from lgp.exceptions import ArchitectureException
239 +from logilab.packaging.lgp.utils import get_architectures
240 +from logilab.packaging.lgp.exceptions import ArchitectureException
241 
242 
243  class ArchitectureTC(TestCase):
244 
245      def test_default_architecture(self):
diff --git a/test/unittest_build.py b/test/unittest_build.py
@@ -6,15 +6,15 @@
246  import tempfile
247  import tarfile
248 
249  from logilab.common.testlib import TestCase, unittest_main, within_tempdir
250 
251 -from lgp.utils import tempdir
252 -from lgp.exceptions import LGPCommandException
253 -from lgp import build
254 +from logilab.packaging.lgp.utils import tempdir
255 +from logilab.packaging.lgp.exceptions import LGPCommandException
256 +from logilab.packaging.lgp import build
257 
258 -from lgp.check import check_debsign
259 +from logilab.packaging.lgp.check import check_debsign
260 
261 
262  class BuildTC(TestCase):
263 
264      def setUp(self):
diff --git a/test/unittest_changelog.py b/test/unittest_changelog.py
@@ -1,11 +1,11 @@
265  from os.path import join, dirname
266  from cStringIO import StringIO
267 
268  from logilab.common.testlib import TestCase, unittest_main
269 
270 -from lgp.lib.changelog import *
271 +from logilab.packaging.lib.changelog import *
272 
273 
274  class ChangeLogTC(TestCase):
275      cl_class = ChangeLog
276      cl_file = join(dirname(__file__), 'data', 'ChangeLog')
diff --git a/test/unittest_distributions.py b/test/unittest_distributions.py
@@ -1,10 +1,10 @@
277  import os.path
278 
279  from logilab.common.testlib import TestCase, unittest_main
280 -from lgp.utils import get_distributions
281 -from lgp.exceptions import DistributionException
282 +from logilab.packaging.lgp.utils import get_distributions
283 +from logilab.packaging.lgp.exceptions import DistributionException
284 
285 
286 
287  class DistributionTC(TestCase):
288 
diff --git a/test/unittest_lgputils.py b/test/unittest_lgputils.py
@@ -5,11 +5,11 @@
289  try:
290      from unittest2 import main, TestCase
291  except ImportError:
292      from unittest import main, TestCase
293 
294 -from lgp import utils
295 +from logilab.packaging.lgp import utils
296 
297  class UtilsTC(TestCase):
298      def test_tempdir_utility(self):
299          with self.assertRaises(AssertionError):
300              with utils.tempdir(False) as tmpdir:
diff --git a/test/unittest_manifest.py b/test/unittest_manifest.py
@@ -16,12 +16,12 @@
301 
302  import sys
303  from os.path import dirname, join
304  from logilab.common.testlib import TestCase, unittest_main
305 
306 -from lgp.lib.manifest import *
307 -from lgp.lib import TextReporter
308 +from logilab.packaging.lib.manifest import *
309 +from logilab.packaging.lib import TextReporter
310 
311  reporter = TextReporter()
312 
313  class MatchExtensionsFunctionTest(TestCase):
314 
diff --git a/test/unittest_pkginfo.py b/test/unittest_pkginfo.py
@@ -1,8 +1,8 @@
315  import os
316  from logilab.common.testlib import TestCase, unittest_main
317 -from lgp.lib import pkginfo, TextReporter
318 +from logilab.packaging.lib import pkginfo, TextReporter
319 
320  class PkgInfoProject(TestCase):
321 
322      def test_pkginfo_project_itself(self):
323          self.assertEqual(pkginfo.check_info_module(TextReporter(),