Skip to content

Commit e116b2b

Browse files
Merge pull request #275 from pytest-dev/upgrade-vendor-libs
upgrade apipkg
2 parents d2a6541 + f3a1a59 commit e116b2b

File tree

15 files changed

+112
-73
lines changed

15 files changed

+112
-73
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@ jobs:
3434
uses: actions/setup-python@v2
3535
with:
3636
python-version: ${{ matrix.python }}
37-
- name: Install tox
38-
run: |
39-
python -m pip install --upgrade pip
40-
pip install tox
4137
- name: Test
4238
run: |
43-
tox -e ${{ matrix.tox_env }}
39+
pipx run tox -e ${{ matrix.tox_env }}
4440
4541
deploy:
4642

py/_vendored_packages/apipkg-1.5.dist-info/RECORD

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
Permission is hereby granted, free of charge, to any person obtaining a copy
3+
of this software and associated documentation files (the "Software"), to deal
4+
in the Software without restriction, including without limitation the rights
5+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6+
copies of the Software, and to permit persons to whom the Software is
7+
furnished to do so, subject to the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included in all
10+
copies or substantial portions of the Software.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
SOFTWARE.

py/_vendored_packages/apipkg-1.5.dist-info/METADATA renamed to py/_vendored_packages/apipkg-2.0.0.dist-info/METADATA

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Metadata-Version: 2.1
22
Name: apipkg
3-
Version: 1.5
3+
Version: 2.0.0
44
Summary: apipkg: namespace control and lazy-import mechanism
55
Home-page: https://github.com/pytest-dev/apipkg
66
Author: holger krekel
77
Maintainer: Ronny Pfannschmidt
88
Maintainer-email: opensource@ronnypfannschmidt.de
9-
License: MIT License
9+
License: MIT
1010
Platform: unix
1111
Platform: linux
1212
Platform: osx
@@ -15,21 +15,27 @@ Platform: win32
1515
Classifier: Development Status :: 4 - Beta
1616
Classifier: Intended Audience :: Developers
1717
Classifier: License :: OSI Approved :: MIT License
18-
Classifier: Operating System :: POSIX
19-
Classifier: Operating System :: Microsoft :: Windows
2018
Classifier: Operating System :: MacOS :: MacOS X
21-
Classifier: Topic :: Software Development :: Libraries
19+
Classifier: Operating System :: Microsoft :: Windows
20+
Classifier: Operating System :: POSIX
2221
Classifier: Programming Language :: Python
2322
Classifier: Programming Language :: Python :: 2
2423
Classifier: Programming Language :: Python :: 2.7
2524
Classifier: Programming Language :: Python :: 3
2625
Classifier: Programming Language :: Python :: 3.4
2726
Classifier: Programming Language :: Python :: 3.5
2827
Classifier: Programming Language :: Python :: 3.6
29-
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
28+
Classifier: Programming Language :: Python :: 3.7
29+
Classifier: Programming Language :: Python :: 3.8
30+
Classifier: Programming Language :: Python :: 3.9
31+
Classifier: Programming Language :: Python :: Implementation :: CPython
32+
Classifier: Topic :: Software Development :: Libraries
33+
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7
34+
Description-Content-Type: text/x-rst
35+
License-File: LICENSE
3036

31-
Welcome to apipkg!
32-
------------------------
37+
Welcome to apipkg !
38+
-------------------
3339

3440
With apipkg you can control the exported namespace of a Python package and
3541
greatly reduce the number of imports for your users.
@@ -47,6 +53,7 @@ Tutorial example
4753
Here is a simple ``mypkg`` package that specifies one namespace
4854
and exports two objects imported from different modules::
4955

56+
5057
# mypkg/__init__.py
5158
import apipkg
5259
apipkg.initpkg(__name__, {
@@ -106,10 +113,13 @@ Feedback?
106113

107114
If you have questions you are welcome to
108115

109-
* join the #pylib channel on irc.freenode.net
110-
* create an issue on https://github.com/pytest-dev/apipkg/issues
116+
* join the **#pytest** channel on irc.libera.chat_
117+
(using an IRC client, via webchat_, or via Matrix_).
118+
* create an issue on the bugtracker_
111119

112-
have fun,
113-
holger krekel
120+
.. _irc.libera.chat: ircs://irc.libera.chat:6697/#pytest
121+
.. _webchat: https://web.libera.chat/#pytest
122+
.. _matrix: https://matrix.to/#/%23pytest:libera.chat
123+
.. _bugtracker: https://github.com/pytest-dev/apipkg/issues
114124

115125

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apipkg-2.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2+
apipkg-2.0.0.dist-info/LICENSE,sha256=6J7tEHTTqUMZi6E5uAhE9bRFuGC7p0qK6twGEFZhZOo,1054
3+
apipkg-2.0.0.dist-info/METADATA,sha256=GqNwkxraK5UTxObLVXTLc2UqktOPwZnKqdk2ThzHX0A,4292
4+
apipkg-2.0.0.dist-info/RECORD,,
5+
apipkg-2.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6+
apipkg-2.0.0.dist-info/WHEEL,sha256=WzZ8cwjh8l0jtULNjYq1Hpr-WCqCRgPr--TX4P5I1Wo,110
7+
apipkg-2.0.0.dist-info/top_level.txt,sha256=3TGS6nmN7kjxhUK4LpPCB3QkQI34QYGrT0ZQGWajoZ8,7
8+
apipkg/__init__.py,sha256=gpbD3O57S9f-LsO2e-XwI6IGISayicfnCq3B5y_8frg,6978
9+
apipkg/__pycache__/__init__.cpython-39.pyc,,
10+
apipkg/__pycache__/version.cpython-39.pyc,,
11+
apipkg/version.py,sha256=bgZFg-f3UKhgE-z2w8RoFrwqRBzJBZkM4_jKFiYB9eU,142

py/_vendored_packages/apipkg-1.5.dist-info/WHEEL renamed to py/_vendored_packages/apipkg-2.0.0.dist-info/WHEEL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Wheel-Version: 1.0
2-
Generator: bdist_wheel (0.31.1)
2+
Generator: bdist_wheel (0.37.0)
33
Root-Is-Purelib: true
44
Tag: py2-none-any
55
Tag: py3-none-any

py/_vendored_packages/apipkg/__init__.py

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
import sys
1010
from types import ModuleType
1111

12-
from .version import version as __version__
12+
from .version import version as __version__ # NOQA:F401
1313

1414

1515
def _py_abspath(path):
1616
"""
1717
special version of abspath
1818
that will leave paths from jython jars alone
1919
"""
20-
if path.startswith('__pyclasspath__'):
20+
if path.startswith("__pyclasspath__"):
2121

2222
return path
2323
else:
@@ -28,6 +28,7 @@ def distribution_version(name):
2828
"""try to get the version of the named distribution,
2929
returs None on failure"""
3030
from pkg_resources import get_distribution, DistributionNotFound
31+
3132
try:
3233
dist = get_distribution(name)
3334
except DistributionNotFound:
@@ -41,35 +42,37 @@ def initpkg(pkgname, exportdefs, attr=None, eager=False):
4142
attr = attr or {}
4243
oldmod = sys.modules.get(pkgname)
4344
d = {}
44-
f = getattr(oldmod, '__file__', None)
45+
f = getattr(oldmod, "__file__", None)
4546
if f:
4647
f = _py_abspath(f)
47-
d['__file__'] = f
48-
if hasattr(oldmod, '__version__'):
49-
d['__version__'] = oldmod.__version__
50-
if hasattr(oldmod, '__loader__'):
51-
d['__loader__'] = oldmod.__loader__
52-
if hasattr(oldmod, '__path__'):
53-
d['__path__'] = [_py_abspath(p) for p in oldmod.__path__]
54-
if hasattr(oldmod, '__package__'):
55-
d['__package__'] = oldmod.__package__
56-
if '__doc__' not in exportdefs and getattr(oldmod, '__doc__', None):
57-
d['__doc__'] = oldmod.__doc__
48+
d["__file__"] = f
49+
if hasattr(oldmod, "__version__"):
50+
d["__version__"] = oldmod.__version__
51+
if hasattr(oldmod, "__loader__"):
52+
d["__loader__"] = oldmod.__loader__
53+
if hasattr(oldmod, "__path__"):
54+
d["__path__"] = [_py_abspath(p) for p in oldmod.__path__]
55+
if hasattr(oldmod, "__package__"):
56+
d["__package__"] = oldmod.__package__
57+
if "__doc__" not in exportdefs and getattr(oldmod, "__doc__", None):
58+
d["__doc__"] = oldmod.__doc__
59+
d["__spec__"] = getattr(oldmod, "__spec__", None)
5860
d.update(attr)
5961
if hasattr(oldmod, "__dict__"):
6062
oldmod.__dict__.update(d)
6163
mod = ApiModule(pkgname, exportdefs, implprefix=pkgname, attr=d)
6264
sys.modules[pkgname] = mod
6365
# eagerload in bypthon to avoid their monkeypatching breaking packages
64-
if 'bpython' in sys.modules or eager:
66+
if "bpython" in sys.modules or eager:
6567
for module in list(sys.modules.values()):
6668
if isinstance(module, ApiModule):
6769
module.__dict__
70+
return mod
6871

6972

7073
def importobj(modpath, attrname):
7174
"""imports a module, then resolves the attrname on it"""
72-
module = __import__(modpath, None, None, ['__doc__'])
75+
module = __import__(modpath, None, None, ["__doc__"])
7376
if not attrname:
7477
return module
7578

@@ -82,20 +85,22 @@ def importobj(modpath, attrname):
8285

8386
class ApiModule(ModuleType):
8487
"""the magical lazy-loading module standing"""
88+
8589
def __docget(self):
8690
try:
8791
return self.__doc
8892
except AttributeError:
89-
if '__doc__' in self.__map__:
90-
return self.__makeattr('__doc__')
93+
if "__doc__" in self.__map__:
94+
return self.__makeattr("__doc__")
9195

9296
def __docset(self, value):
9397
self.__doc = value
98+
9499
__doc__ = property(__docget, __docset)
95100

96101
def __init__(self, name, importspec, implprefix=None, attr=None):
97102
self.__name__ = name
98-
self.__all__ = [x for x in importspec if x != '__onfirstaccess__']
103+
self.__all__ = [x for x in importspec if x != "__onfirstaccess__"]
99104
self.__map__ = {}
100105
self.__implprefix__ = implprefix or name
101106
if attr:
@@ -104,47 +109,47 @@ def __init__(self, name, importspec, implprefix=None, attr=None):
104109
setattr(self, name, val)
105110
for name, importspec in importspec.items():
106111
if isinstance(importspec, dict):
107-
subname = '%s.%s' % (self.__name__, name)
112+
subname = "{}.{}".format(self.__name__, name)
108113
apimod = ApiModule(subname, importspec, implprefix)
109114
sys.modules[subname] = apimod
110115
setattr(self, name, apimod)
111116
else:
112-
parts = importspec.split(':')
117+
parts = importspec.split(":")
113118
modpath = parts.pop(0)
114119
attrname = parts and parts[0] or ""
115-
if modpath[0] == '.':
120+
if modpath[0] == ".":
116121
modpath = implprefix + modpath
117122

118123
if not attrname:
119-
subname = '%s.%s' % (self.__name__, name)
124+
subname = "{}.{}".format(self.__name__, name)
120125
apimod = AliasModule(subname, modpath)
121126
sys.modules[subname] = apimod
122-
if '.' not in name:
127+
if "." not in name:
123128
setattr(self, name, apimod)
124129
else:
125130
self.__map__[name] = (modpath, attrname)
126131

127132
def __repr__(self):
128133
repr_list = []
129-
if hasattr(self, '__version__'):
134+
if hasattr(self, "__version__"):
130135
repr_list.append("version=" + repr(self.__version__))
131-
if hasattr(self, '__file__'):
132-
repr_list.append('from ' + repr(self.__file__))
136+
if hasattr(self, "__file__"):
137+
repr_list.append("from " + repr(self.__file__))
133138
if repr_list:
134-
return '<ApiModule %r %s>' % (self.__name__, " ".join(repr_list))
135-
return '<ApiModule %r>' % (self.__name__,)
139+
return "<ApiModule {!r} {}>".format(self.__name__, " ".join(repr_list))
140+
return "<ApiModule {!r}>".format(self.__name__)
136141

137142
def __makeattr(self, name):
138143
"""lazily compute value for name or raise AttributeError if unknown."""
139144
# print "makeattr", self.__name__, name
140145
target = None
141-
if '__onfirstaccess__' in self.__map__:
142-
target = self.__map__.pop('__onfirstaccess__')
146+
if "__onfirstaccess__" in self.__map__:
147+
target = self.__map__.pop("__onfirstaccess__")
143148
importobj(*target)()
144149
try:
145150
modpath, attrname = self.__map__[name]
146151
except KeyError:
147-
if target is not None and name != '__onfirstaccess__':
152+
if target is not None and name != "__onfirstaccess__":
148153
# retry, onfirstaccess might have set attrs
149154
return getattr(self, name)
150155
raise AttributeError(name)
@@ -163,10 +168,10 @@ def __makeattr(self, name):
163168
def __dict__(self):
164169
# force all the content of the module
165170
# to be loaded when __dict__ is read
166-
dictdescr = ModuleType.__dict__['__dict__']
171+
dictdescr = ModuleType.__dict__["__dict__"]
167172
dict = dictdescr.__get__(self)
168173
if dict is not None:
169-
hasattr(self, 'some')
174+
hasattr(self, "some")
170175
for name in self.__all__:
171176
try:
172177
self.__makeattr(name)
@@ -186,19 +191,22 @@ def getmod():
186191
mod.append(x)
187192
return mod[0]
188193

189-
class AliasModule(ModuleType):
194+
x = modpath + ("." + attrname if attrname else "")
195+
repr_result = "<AliasModule {!r} for {!r}>".format(modname, x)
190196

197+
class AliasModule(ModuleType):
191198
def __repr__(self):
192-
x = modpath
193-
if attrname:
194-
x += "." + attrname
195-
return '<AliasModule %r for %r>' % (modname, x)
199+
return repr_result
196200

197201
def __getattribute__(self, name):
198202
try:
199203
return getattr(getmod(), name)
200204
except ImportError:
201-
return None
205+
if modpath == "pytest" and attrname is None:
206+
# hack for pylibs py.test
207+
return None
208+
else:
209+
raise
202210

203211
def __setattr__(self, name, value):
204212
setattr(getmod(), name, value)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# coding: utf-8
22
# file generated by setuptools_scm
33
# don't change, don't track in version control
4-
version = '1.5'
4+
version = '2.0.0'
5+
version_tuple = (2, 0, 0)

py/_vendored_packages/iniconfig-1.1.1.dist-info/RECORD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
../../../../home/ran/.cache/pycache/tmp/pip-target-oxds71ih/lib/python/iniconfig/__init__.cpython-39.pyc,,
21
iniconfig-1.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
32
iniconfig-1.1.1.dist-info/LICENSE,sha256=KvaAw570k_uCgwNW0dPfGstaBgM8ui3sehniHKp3qGY,1061
43
iniconfig-1.1.1.dist-info/METADATA,sha256=_4-oFKpRXuZv5rzepScpXRwhq6DzqsgbnA5ZpgMUMcs,2405
@@ -8,4 +7,5 @@ iniconfig-1.1.1.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rce
87
iniconfig-1.1.1.dist-info/top_level.txt,sha256=7KfM0fugdlToj9UW7enKXk2HYALQD8qHiyKtjhSzgN8,10
98
iniconfig/__init__.py,sha256=-pBe5AF_6aAwo1CxJQ8i_zJq6ejc6IxHta7qk2tNJhY,5208
109
iniconfig/__init__.pyi,sha256=-4KOctzq28ohRmTZsqlH6aylyFqsNKxYqtk1dteypi4,1205
10+
iniconfig/__pycache__/__init__.cpython-39.pyc,,
1111
iniconfig/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools",
4+
"setuptools_scm[toml]",
5+
]
6+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def main():
77
description='library with cross-python path, ini-parsing, io, code, log facilities',
88
long_description=open('README.rst').read(),
99
use_scm_version={"write_to": "py/_version.py"},
10-
setup_requires=["setuptools-scm"],
10+
setup_requires=["setuptools_scm"],
1111
url='https://py.readthedocs.io/',
1212
license='MIT license',
1313
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

testing/log/test_warning.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
mypath = py.path.local(__file__).new(ext=".py")
99

1010

11-
win = sys.platform.startswith('win')
12-
pytestmark = pytest.mark.skipif(win and LooseVersion(pytest.__version__) >= LooseVersion('3.1'),
11+
pytestmark = pytest.mark.skipif(LooseVersion(pytest.__version__) >= LooseVersion('3.1'),
1312
reason='apiwarn is not compatible with pytest >= 3.1 (#162)')
1413

1514

0 commit comments

Comments
 (0)