Move lgp back into the logilab namespace

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

authorJulien Cristau <julien.cristau@logilab.fr>
changeseteb26c691eb74
branchdefault
phasedraft
hiddenyes
parent revision#0288dc5ea460 Added tag debian/1.2.0-2 for changeset 8abe76cf4a8b
child revision#48fd6f1ac4a9 [debian] rename binary package to match module name, #ffe8e9598b8f [debian] rename binary package to match module name, #7f0d8cf8182e [debian] rename binary package to match module name
files modified by this revision
bin/lgp
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
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1438154947 -7200
# Wed Jul 29 09:29:07 2015 +0200
# Node ID eb26c691eb746090fc678c506f6f95c6dee0797c
# Parent 0288dc5ea4606894057722a8c595e8d5048c9b08
Move lgp back into the logilab namespace

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/logilab/__init__.py b/logilab/__init__.py
@@ -0,0 +1,1 @@
7 +__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 @@
8  import logging
9  import pkg_resources
10 
11  import logilab.common.clcommands as cli
12 
13 -from lgp.exceptions import LGPException
14 +from logilab.packaging.lgp.exceptions import LGPException
15 
16  pkg = pkg_resources.get_distribution('logilab-packaging')
17  __version__ = version = pkg.version
18 
19  def _get_description(pkginfo):
diff --git a/lgp/build.py b/logilab/packaging/lgp/build.py
@@ -30,17 +30,17 @@
20  from debian import deb822
21 
22  from logilab.common.shellutils import cp
23  from logilab.common.fileutils import export
24 
25 -from lgp import LGP, CONFIG_FILE, HOOKS_DIR, utils
26 -from lgp.exceptions import (LGPException, LGPCommandException)
27 -from lgp.utils import tempdir
28 +from logilab.packaging.lgp import LGP, CONFIG_FILE, HOOKS_DIR, utils
29 +from logilab.packaging.lgp.exceptions import (LGPException, LGPCommandException)
30 +from logilab.packaging.lgp.utils import tempdir
31 
32 -from lgp.check import check_debsign
33 -from lgp.setupinfo import SetupInfo
34 -from lgp.clean import Cleaner
35 +from logilab.packaging.lgp.check import check_debsign
36 +from logilab.packaging.lgp.setupinfo import SetupInfo
37 +from logilab.packaging.lgp.clean import Cleaner
38 
39 
40  @LGP.register
41  class Builder(SetupInfo):
42      """Build a debian package.
diff --git a/lgp/check.py b/logilab/packaging/lgp/check.py
@@ -25,16 +25,16 @@
43  import itertools
44  import subprocess
45  from os.path import basename, join, exists, isdir, isfile
46  from glob import glob
47 
48 -from lgp import BASE_EXCLUDE, __path__
49 -from lgp import LGP, LGP_CONFIG_FILE, utils
50 -from lgp.setupinfo import SetupInfo
51 -from lgp.exceptions import LGPException
52 -from lgp.lib.changelog import CHANGEFILE
53 -from lgp.lib.manifest import (get_manifest_files, read_manifest_in,
54 +from logilab.packaging.lgp import BASE_EXCLUDE, __path__
55 +from logilab.packaging.lgp import LGP, LGP_CONFIG_FILE, utils
56 +from logilab.packaging.lgp.setupinfo import SetupInfo
57 +from logilab.packaging.lgp.exceptions import LGPException
58 +from logilab.packaging.lib.changelog import CHANGEFILE
59 +from logilab.packaging.lib.manifest import (get_manifest_files, read_manifest_in,
60                                             match_extensions, JUNK_EXTENSIONS)
61 
62 
63  OK, NOK = 1, 0
64  CHECKS = {'debian'    : set(['debian_dir', 'debian_rules', 'debian_copying',
@@ -550,11 +550,11 @@
65              checker.logger.warn('command "python __pkginfo__.py" returns errors')
66      else:
67          return status
68 
69      # check mandatory attributes defined by pkginfo policy
70 -    from lgp.lib.pkginfo import check_info_module
71 +    from logilab.packaging.lib.pkginfo import check_info_module
72      class Reporter(object):
73          def warning(self, path, line, msg):
74              checker.logger.warn(msg)
75          def error(self, path, line, msg):
76              checker.logger.error(msg)
diff --git a/lgp/clean.py b/logilab/packaging/lgp/clean.py
@@ -16,12 +16,12 @@
77  # this program; if not, write to the Free Software Foundation, Inc.,
78  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
79 
80  import os
81 
82 -from lgp import LGP
83 -from lgp.setupinfo import SetupInfo
84 +from logilab.packaging.lgp import LGP
85 +from logilab.packaging.lgp.setupinfo import SetupInfo
86 
87 
88  @LGP.register
89  class Cleaner(SetupInfo):
90      """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 @@
91  import os
92  import sys
93  import glob
94  from subprocess import check_call, CalledProcessError
95 
96 -from lgp import (LGP, CONFIG_FILE, HOOKS_DIR, utils)
97 -from lgp.setupinfo import SetupInfo
98 -from lgp.check import check_keyrings
99 +from logilab.packaging.lgp import (LGP, CONFIG_FILE, HOOKS_DIR, utils)
100 +from logilab.packaging.lgp.setupinfo import SetupInfo
101 +from logilab.packaging.lgp.check import check_keyrings
102 
103 
104  @LGP.register
105  class Setup(SetupInfo):
106      """Set up and manage build images.
diff --git a/lgp/setupinfo.py b/logilab/packaging/lgp/setupinfo.py
@@ -32,13 +32,13 @@
107  from logilab.common import clcommands
108  from logilab.common.logging_ext import ColorFormatter
109  from logilab.common.shellutils import cp
110  from logilab.common.decorators import cached
111 
112 -from lgp.lib.pkginfo import PackageInfo
113 -from lgp import LOG_FORMAT, utils
114 -from lgp.exceptions import LGPException, LGPCommandException
115 +from logilab.packaging.lib.pkginfo import PackageInfo
116 +from logilab.packaging.lgp import LOG_FORMAT, utils
117 +from logilab.packaging.lgp.exceptions import LGPException, LGPCommandException
118 
119  COMMANDS = {
120          'file': {
121              "sdist": '$setup dist-gzip -e DIST_DIR=$dist_dir',
122              "clean": '$setup clean',
@@ -239,11 +239,11 @@
123              self.logger.info('use specific setup file: %s', setup_file)
124 
125          if osp.isfile('__pkginfo__.py') and not setup_file:
126              # Logilab's specific format
127              # FIXME Format is buggy if setup_file was set to 'setup.py'
128 -            from lgp.lib import TextReporter
129 +            from logilab.packaging.lib import TextReporter
130              self.config._package = PackageInfo(reporter=TextReporter(file(os.devnull, "w+")),
131                                                 directory=self.config.pkg_dir)
132              assert osp.isfile('setup.py'), "setup.py is still mandatory"
133          # other script can be used if compatible with the expected targets in COMMANDS
134          elif osp.isfile(setup_file):
diff --git a/lgp/shell.py b/logilab/packaging/lgp/shell.py
@@ -19,12 +19,12 @@
135  import os
136  import sys
137  import glob
138  from subprocess import check_call, CalledProcessError
139 
140 -from lgp import LGP, CONFIG_FILE, HOOKS_DIR, SCRIPTS_DIR
141 -from lgp.setupinfo import SetupInfo
142 +from logilab.packaging.lgp import LGP, CONFIG_FILE, HOOKS_DIR, SCRIPTS_DIR
143 +from logilab.packaging.lgp.setupinfo import SetupInfo
144 
145  @LGP.register
146  class Shell(SetupInfo):
147      """Run a script or interactive shell in a chrooted distribution"""
148 
diff --git a/lgp/tag.py b/logilab/packaging/lgp/tag.py
@@ -19,13 +19,13 @@
149  import os, os.path as osp
150  import ConfigParser
151  from string import Template
152  from subprocess import check_call
153 
154 -from lgp import LGP, LGP_CONFIG_FILE
155 -from lgp.setupinfo import SetupInfo
156 -from lgp.exceptions import LGPException
157 +from logilab.packaging.lgp import LGP, LGP_CONFIG_FILE
158 +from logilab.packaging.lgp.setupinfo import SetupInfo
159 +from logilab.packaging.lgp.exceptions import LGPException
160 
161 
162  @LGP.register
163  class Tagger(SetupInfo):
164      """Tag the project source repository.
diff --git a/lgp/utils.py b/logilab/packaging/lgp/utils.py
@@ -27,12 +27,12 @@
165  import logging
166 
167  from debian.deb822 import Deb822
168  from debian.changelog import Changelog, ChangelogParseError
169 
170 -from lgp import LGP_SUITES
171 -from lgp.exceptions import (ArchitectureException,
172 +from logilab.packaging.lgp import LGP_SUITES
173 +from logilab.packaging.lgp.exceptions import (ArchitectureException,
174                                                DistributionException,
175                                                SetupException,
176                                                LGPException)
177 
178 
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 @@
179  from distutils.filelist import FileList
180  from distutils.text_file import TextFile
181  from distutils.errors import DistutilsTemplateError
182  import distutils
183 
184 -from lgp import BASE_EXCLUDE
185 +from logilab.packaging.lgp import BASE_EXCLUDE
186 
187  JUNK_EXTENSIONS = ('~', '.pyc', '.pyo', '.fo', '.o', '.so', '.swp', '.orig')
188 
189  def match_extensions(filename, extensions):
190      """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 @@
191 
192  from logilab.common.fileutils import lines, ensure_fs_mode
193  from logilab.common.shellutils import find
194  from logilab.common.deprecation import deprecated
195 
196 -import lgp
197 -from lgp.lib import TextReporter
198 -from lgp.lib.utils import SGMLCatalog, get_scripts, glob_match
199 -from lgp import BASE_EXCLUDE
200 +import logilab.packaging.lgp
201 +from logilab.packaging.lib import TextReporter
202 +from logilab.packaging.lib.utils import SGMLCatalog, get_scripts, glob_match
203 +from logilab.packaging.lgp import BASE_EXCLUDE
204 
205  try:
206      from scriptfoundry.snakespell import iSpell
207      def spell_check(text, dictionary='american', ignore=()):
208          """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 @@
209  import re
210  import os
211  import glob
212  from os.path import basename, join, split, exists
213 
214 -from lgp import BASE_EXCLUDE
215 +from logilab.packaging.lgp import BASE_EXCLUDE
216 
217  PUBLIC_RGX = re.compile('PUBLIC\s+"-//(?P<group>.*)//DTD (?P<pubid>.*)//(?P<lang>\w\w)(//XML)?"\s*"(?P<dtd>.*)"')
218 
219 
220  class SGMLCatalog:
diff --git a/setup.py b/setup.py
@@ -68,7 +68,7 @@
221 
222      packages=find_packages(exclude=['contrib', 'docs', 'test*']),
223      install_requires=pkginfo['install_requires'],
224      scripts=pkginfo['scripts'],
225      data_files = pkginfo['data_files'],
226 -
227 +    namespace_packages=['logilab'],
228  )