Merge lp:~jaraco/pkginfo/relative-imports into lp:pkginfo

Proposed by Jason R. Coombs
Status: Merged
Merged at revision: 146
Proposed branch: lp:~jaraco/pkginfo/relative-imports
Merge into: lp:pkginfo
Diff against target: 164 lines (+27/-27)
9 files modified
pkginfo/__init__.py (+9/-9)
pkginfo/bdist.py (+1/-1)
pkginfo/commandline.py (+2/-2)
pkginfo/develop.py (+1/-1)
pkginfo/distribution.py (+3/-3)
pkginfo/index.py (+1/-1)
pkginfo/installed.py (+2/-2)
pkginfo/sdist.py (+1/-1)
pkginfo/utils.py (+7/-7)
To merge this branch: bzr merge lp:~jaraco/pkginfo/relative-imports
Reviewer Review Type Date Requested Status
Tres Seaver Pending
Review via email: mp+326263@code.launchpad.net

Description of the change

Use relative imports in pkginfo modules. Fixes #1653126.

Note that I did not update modules in the pkginfo.tests package, as these modules are not used in production use.

To post a comment you must log in.
Revision history for this message
Tres Seaver (tseaver) wrote :

Test failures (all versions):

....................................../home/tseaver/projects/parcel/src/pkginfo-jaraco-relative-imports/pkginfo/develop.py:45: UserWarning: No PKG-INFO found for path: /home/tseaver/projects/parcel/src/pkginfo-jaraco-relative-imports/pkginfo/tests/sneaky
  warnings.warn('No PKG-INFO found for path: %s' % self.path)
F.............................
======================================================================
FAIL: test_ctor_w_path_nested_egg_info (pkginfo.tests.test_develop.DevelopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tseaver/projects/parcel/src/pkginfo-jaraco-relative-imports/pkginfo/tests/test_develop.py", line 22, in test_ctor_w_path_nested_egg_info
    self.assertEqual(develop.metadata_version, '1.0')
AssertionError: None != '1.0'

----------------------------------------------------------------------

Revision history for this message
Jason R. Coombs (jaraco) wrote :
Download full text (4.2 KiB)

I get those same test failures in trunk:

```
$ bzr log --limit 1
------------------------------------------------------------
revno: 143
tags: 1.4.1
committer: Tres Seaver <email address hidden>
branch nick: pkginfo
timestamp: Mon 2016-11-07 09:38:05 -0500
message:
  Prep 1.4.1 release.
$ tox -e python
python installed: -e bzr+http://bazaar.launchpad.net/~tseaver/pkginfo/trunk/@143#egg=pkginfo
python runtests: PYTHONHASHSEED='3929298432'
python runtests: commands[0] | python setup.py develop
running develop
running egg_info
writing pkginfo.egg-info/PKG-INFO
writing dependency_links to pkginfo.egg-info/dependency_links.txt
writing entry points to pkginfo.egg-info/entry_points.txt
writing requirements to pkginfo.egg-info/requires.txt
writing top-level names to pkginfo.egg-info/top_level.txt
reading manifest file 'pkginfo.egg-info/SOURCES.txt'
writing manifest file 'pkginfo.egg-info/SOURCES.txt'
running build_ext
Creating /Users/jaraco/Dropbox/code/public/pkginfo/trunk/.tox/python/lib/python3.6/site-packages/pkginfo.egg-link (link to .)
pkginfo 1.4.1 is already the active version in easy-install.pth
Installing pkginfo script to /Users/jaraco/Dropbox/code/public/pkginfo/trunk/.tox/python/bin

Installed /Users/jaraco/Dropbox/code/public/pkginfo/trunk
Processing dependencies for pkginfo==1.4.1
Finished processing dependencies for pkginfo==1.4.1
python runtests: commands[1] | python setup.py test -q
running test
running egg_info
writing pkginfo.egg-info/PKG-INFO
writing dependency_links to pkginfo.egg-info/dependency_links.txt
writing entry points to pkginfo.egg-info/entry_points.txt
writing requirements to pkginfo.egg-info/requires.txt
writing top-level names to pkginfo.egg-info/top_level.txt
reading manifest file 'pkginfo.egg-info/SOURCES.txt'
writing manifest file 'pkginfo.egg-info/SOURCES.txt'
running build_ext
.........................................................................................................................../Users/jaraco/Dropbox/code/public/pkginfo/trunk/pkginfo/develop.py:45: UserWarning: No PKG-INFO found for path: /Users/jaraco/Dropbox/code/public/pkginfo/trunk/pkginfo/tests/sneaky
  warnings.warn('No PKG-INFO found for path: %s' % self.path)
F........................
======================================================================
FAIL: test_ctor_w_path_nested_egg_info (pkginfo.tests.test_develop.DevelopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/pkginfo/trunk/pkginfo/tests/test_develop.py", line 22, in test_ctor_w_path_nested_egg_info
    self.assertEqual(develop.metadata_version, '1.0')
AssertionError: None != '1.0'

----------------------------------------------------------------------
Ran 148 tests in 0.166s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=148 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=148 errors=0 failures=1>
ERROR: InvocationError: '/Users/jaraco/Dropbox/code/public/pkginfo/trunk/.tox/python/bin/python setup.py test -q'
____________________________________________ summary _____________________________________________
E...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pkginfo/__init__.py'
2--- pkginfo/__init__.py 2013-11-27 22:09:41 +0000
3+++ pkginfo/__init__.py 2017-06-24 21:35:12 +0000
4@@ -1,9 +1,9 @@
5-from pkginfo.bdist import BDist
6-from pkginfo.develop import Develop
7-from pkginfo.distribution import Distribution
8-from pkginfo.index import Index
9-from pkginfo.installed import Installed
10-from pkginfo.sdist import SDist
11-from pkginfo.sdist import UnpackedSDist
12-from pkginfo.utils import get_metadata
13-from pkginfo.wheel import Wheel
14+from .bdist import BDist
15+from .develop import Develop
16+from .distribution import Distribution
17+from .index import Index
18+from .installed import Installed
19+from .sdist import SDist
20+from .sdist import UnpackedSDist
21+from .utils import get_metadata
22+from .wheel import Wheel
23
24=== modified file 'pkginfo/bdist.py'
25--- pkginfo/bdist.py 2012-12-28 22:07:03 +0000
26+++ pkginfo/bdist.py 2017-06-24 21:35:12 +0000
27@@ -1,7 +1,7 @@
28 import os
29 import zipfile
30
31-from pkginfo.distribution import Distribution
32+from .distribution import Distribution
33
34 class BDist(Distribution):
35
36
37=== modified file 'pkginfo/commandline.py'
38--- pkginfo/commandline.py 2015-01-02 17:56:35 +0000
39+++ pkginfo/commandline.py 2017-06-24 21:35:12 +0000
40@@ -25,7 +25,7 @@
41 import os
42 import sys
43
44-from pkginfo import get_metadata
45+from .utils import get_metadata
46
47
48 def _parse_options(args=None):
49@@ -39,7 +39,7 @@
50 )
51
52 parser.add_option("-d", "--download-url-prefix",
53- dest="download_url_prefix",
54+ dest="download_url_prefix",
55 help="Download URL prefix",
56 )
57
58
59=== modified file 'pkginfo/develop.py'
60--- pkginfo/develop.py 2013-05-05 15:52:03 +0000
61+++ pkginfo/develop.py 2017-06-24 21:35:12 +0000
62@@ -2,7 +2,7 @@
63 import sys
64 import warnings
65
66-from pkginfo.distribution import Distribution
67+from .distribution import Distribution
68
69 def _gather_py2(top, candidates): #pragma NO COVER Py3k
70 def _filter(candidates, dirname, fnames):
71
72=== modified file 'pkginfo/distribution.py'
73--- pkginfo/distribution.py 2013-11-27 22:09:41 +0000
74+++ pkginfo/distribution.py 2017-06-24 21:35:12 +0000
75@@ -1,7 +1,7 @@
76 from email.parser import Parser
77
78-from pkginfo._compat import StringIO
79-from pkginfo._compat import must_decode
80+from ._compat import StringIO
81+from ._compat import must_decode
82
83
84 def parse(fp):
85@@ -126,7 +126,7 @@
86 value = get(msg, header_name)
87 if value != 'UNKNOWN':
88 setattr(self, attr_name, value)
89-
90+
91 def __iter__(self):
92 for header_name, attr_name, multiple in self._getHeaderAttrs():
93 yield attr_name
94
95=== modified file 'pkginfo/index.py'
96--- pkginfo/index.py 2009-06-05 01:22:15 +0000
97+++ pkginfo/index.py 2017-06-24 21:35:12 +0000
98@@ -1,4 +1,4 @@
99-from pkginfo.distribution import Distribution
100+from .distribution import Distribution
101
102 class Index(dict):
103
104
105=== modified file 'pkginfo/installed.py'
106--- pkginfo/installed.py 2012-12-28 20:31:51 +0000
107+++ pkginfo/installed.py 2017-06-24 21:35:12 +0000
108@@ -3,8 +3,8 @@
109 import sys
110 import warnings
111
112-from pkginfo.distribution import Distribution
113-from pkginfo._compat import STRING_TYPES
114+from .distribution import Distribution
115+from ._compat import STRING_TYPES
116
117 class Installed(Distribution):
118
119
120=== modified file 'pkginfo/sdist.py'
121--- pkginfo/sdist.py 2013-05-05 15:07:09 +0000
122+++ pkginfo/sdist.py 2017-06-24 21:35:12 +0000
123@@ -2,7 +2,7 @@
124 import tarfile
125 import zipfile
126
127-from pkginfo.distribution import Distribution
128+from .distribution import Distribution
129
130 class SDist(Distribution):
131
132
133=== modified file 'pkginfo/utils.py'
134--- pkginfo/utils.py 2013-11-27 22:09:41 +0000
135+++ pkginfo/utils.py 2017-06-24 21:35:12 +0000
136@@ -1,21 +1,21 @@
137 import os
138 from types import ModuleType
139
140-from pkginfo.bdist import BDist
141-from pkginfo.develop import Develop
142-from pkginfo.installed import Installed
143-from pkginfo.sdist import SDist
144-from pkginfo.wheel import Wheel
145+from .bdist import BDist
146+from .develop import Develop
147+from .installed import Installed
148+from .sdist import SDist
149+from .wheel import Wheel
150
151 def get_metadata(path_or_module, metadata_version=None):
152 """ Try to create a Distribution 'path_or_module'.
153-
154+
155 o 'path_or_module' may be a module object.
156
157 o If a string, 'path_or_module' may point to an sdist file, a bdist
158 file, an installed package, or a working checkout (if it contains
159 PKG-INFO).
160-
161+
162 o Return None if 'path_or_module' can't be parsed.
163 """
164 if isinstance(path_or_module, ModuleType):

Subscribers

People subscribed via source and target branches