diff -Nru entrypoints-0.2.3/debian/changelog entrypoints-0.3/debian/changelog --- entrypoints-0.2.3/debian/changelog 2019-01-07 09:38:53.000000000 +0000 +++ entrypoints-0.3/debian/changelog 2019-01-16 17:33:23.000000000 +0000 @@ -1,3 +1,10 @@ +entrypoints (0.3-1) unstable; urgency=medium + + * New upstream release. + * Drop upstream patches as they're in this release. + + -- Julien Puydt Wed, 16 Jan 2019 18:33:23 +0100 + entrypoints (0.2.3-4) unstable; urgency=medium * Team upload. diff -Nru entrypoints-0.2.3/debian/patches/0002-Silences-unimportant-configparser-warning.patch entrypoints-0.3/debian/patches/0002-Silences-unimportant-configparser-warning.patch --- entrypoints-0.2.3/debian/patches/0002-Silences-unimportant-configparser-warning.patch 2019-01-07 08:39:08.000000000 +0000 +++ entrypoints-0.3/debian/patches/0002-Silences-unimportant-configparser-warning.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From 75a9c21a9957b4274caf63ff5a92c0ef78a3597a Mon Sep 17 00:00:00 2001 -From: Thomas Kluyver -Date: Mon, 9 Apr 2018 14:09:38 +0200 -Subject: [PATCH] Put files to read into lists -Origin: https://github.com/takluyver/entrypoints/commit/75a9c21a9957b4274caf63ff5a92c0ef78a3597a - -Silences unimportant configparser warning. - -Closes gh-18 ---- - entrypoints.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/entrypoints.py -+++ b/entrypoints.py -@@ -134,7 +134,7 @@ - ep_path = osp.join(folder, 'EGG-INFO', 'entry_points.txt') - if osp.isfile(ep_path): - cp = CaseSensitiveConfigParser() -- cp.read(ep_path) -+ cp.read([ep_path]) - yield cp, distro - - elif zipfile.is_zipfile(folder): -@@ -165,7 +165,7 @@ - else: - distro = None - cp = CaseSensitiveConfigParser() -- cp.read(path) -+ cp.read([path]) - yield cp, distro - - def get_single(group, name, path=None): diff -Nru entrypoints-0.2.3/debian/patches/0003-Make-regexp-string-raw.patch entrypoints-0.3/debian/patches/0003-Make-regexp-string-raw.patch --- entrypoints-0.2.3/debian/patches/0003-Make-regexp-string-raw.patch 2019-01-07 08:51:08.000000000 +0000 +++ entrypoints-0.3/debian/patches/0003-Make-regexp-string-raw.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -From 0d3a022040841f968b4f51ec620d7377f38a631c Mon Sep 17 00:00:00 2001 -From: Jakub Wilk -Date: Fri, 18 May 2018 11:33:35 +0200 -Subject: [PATCH] Make regexp string raw -Origin: https://github.com/takluyver/entrypoints/commit/0d3a022040841f968b4f51ec620d7377f38a631c - -Fixes Python 3.7 warning: - - .../entrypoints.py:98: DeprecationWarning: invalid escape sequence \s ---- - entrypoints.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/entrypoints.py -+++ b/entrypoints.py -@@ -92,7 +92,7 @@ - if m: - mod, obj, extras = m.group('modulename', 'objectname', 'extras') - if extras is not None: -- extras = re.split(',\s*', extras) -+ extras = re.split(r',\s*', extras) - return cls(name, mod, obj, extras, distro) - else: - raise BadEntryPoint(epstr) diff -Nru entrypoints-0.2.3/debian/patches/series entrypoints-0.3/debian/patches/series --- entrypoints-0.2.3/debian/patches/series 2019-01-07 08:50:45.000000000 +0000 +++ entrypoints-0.3/debian/patches/series 2019-01-16 17:33:23.000000000 +0000 @@ -1,3 +1 @@ 0001-Fix-configparser-import.patch -0002-Silences-unimportant-configparser-warning.patch -0003-Make-regexp-string-raw.patch diff -Nru entrypoints-0.2.3/doc/api.rst entrypoints-0.3/doc/api.rst --- entrypoints-0.2.3/doc/api.rst 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/doc/api.rst 2019-01-07 18:03:55.000000000 +0000 @@ -32,13 +32,13 @@ .. attribute:: object_name The dotted object name within the module, or *None* if the entry point - refers to a module itselfs. + refers to a module itself. .. attribute:: extras Extra setuptools features related to this entry point as a list, or *None* - .. attribute:: distribution + .. attribute:: distro The distribution which advertised this entry point - a :class:`Distribution` instance or None diff -Nru entrypoints-0.2.3/doc/conf.py entrypoints-0.3/doc/conf.py --- entrypoints-0.2.3/doc/conf.py 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/doc/conf.py 2019-01-07 18:03:55.000000000 +0000 @@ -60,9 +60,9 @@ # built documents. # # The short X.Y version. -version = '0.2' +from entrypoints import __version__ as version # The full version, including alpha/beta/rc tags. -release = version + '.3' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru entrypoints-0.2.3/doc/index.rst entrypoints-0.3/doc/index.rst --- entrypoints-0.2.3/doc/index.rst 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/doc/index.rst 2019-01-07 18:03:55.000000000 +0000 @@ -1,20 +1,7 @@ entrypoints |version| ===================== -Entry points are a way for Python packages to advertise objects with some -common interface. The most common examples are ``console_scripts`` entry points, -which define shell commands by identifying a Python function to run. - -*Groups* of entry points, such as ``console_scripts``, point to objects with -similar interfaces. An application might use a group to find its plugins, or -multiple groups if it has different kinds of plugins. - -The **entrypoints** module contains functions to find and load entry points. -You can install it from PyPI with ``pip install entrypoints``. - -To advertise entry points when distributing a package, see -`entry_points in the Python Packaging User Guide -`_. +.. include:: ../README.rst Contents: diff -Nru entrypoints-0.2.3/entrypoints.py entrypoints-0.3/entrypoints.py --- entrypoints-0.2.3/entrypoints.py 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/entrypoints.py 2019-01-07 18:03:55.000000000 +0000 @@ -26,7 +26,12 @@ $ """, re.VERBOSE) -__version__ = '0.2.3' +file_in_zip_pattern = re.compile(r""" +(?P[^/\\]+)\.(dist|egg)-info +[/\\]entry_points.txt$ +""", re.VERBOSE) + +__version__ = '0.3' class BadEntryPoint(Exception): """Raised when an entry point can't be parsed. @@ -80,7 +85,7 @@ for attr in self.object_name.split('.'): obj = getattr(obj, attr) return obj - + @classmethod def from_string(cls, epstr, name, distro=None): """Parse an entry point from the syntax in entry_points.txt @@ -95,7 +100,7 @@ if m: mod, obj, extras = m.group('modulename', 'objectname', 'extras') if extras is not None: - extras = re.split(',\s*', extras) + extras = re.split(r',\s*', extras) return cls(name, mod, obj, extras, distro) else: raise BadEntryPoint(epstr) @@ -104,7 +109,7 @@ def __init__(self, name, version): self.name = name self.version = version - + def __repr__(self): return "Distribution(%r, %r)" % (self.name, self.version) @@ -132,12 +137,12 @@ distro_names_seen.add(distro.name) else: distro = None - + if osp.isdir(folder): ep_path = osp.join(folder, 'EGG-INFO', 'entry_points.txt') if osp.isfile(ep_path): - cp = CaseSensitiveConfigParser() - cp.read(ep_path) + cp = CaseSensitiveConfigParser(delimiters=('=',)) + cp.read([ep_path]) yield cp, distro elif zipfile.is_zipfile(folder): @@ -146,13 +151,39 @@ info = z.getinfo('EGG-INFO/entry_points.txt') except KeyError: continue - cp = CaseSensitiveConfigParser() + cp = CaseSensitiveConfigParser(delimiters=('=',)) with z.open(info) as f: fu = io.TextIOWrapper(f) cp.read_file(fu, source=osp.join(folder, 'EGG-INFO', 'entry_points.txt')) yield cp, distro - + + # zip imports, not egg + elif zipfile.is_zipfile(folder): + with zipfile.ZipFile(folder) as zf: + for info in zf.infolist(): + m = file_in_zip_pattern.match(info.filename) + if not m: + continue + + distro_name_version = m.group('dist_version') + if '-' in distro_name_version: + distro = Distribution(*distro_name_version.split('-', 1)) + + if (repeated_distro == 'first') \ + and (distro.name in distro_names_seen): + continue + distro_names_seen.add(distro.name) + else: + distro = None + + cp = CaseSensitiveConfigParser(delimiters=('=',)) + with zf.open(info) as f: + fu = io.TextIOWrapper(f) + cp.read_file(fu, source=osp.join(folder, info.filename)) + yield cp, distro + + # Regular file imports (not egg, not zip file) for path in itertools.chain( glob.iglob(osp.join(folder, '*.dist-info', 'entry_points.txt')), glob.iglob(osp.join(folder, '*.egg-info', 'entry_points.txt')) @@ -167,8 +198,8 @@ distro_names_seen.add(distro.name) else: distro = None - cp = CaseSensitiveConfigParser() - cp.read(path) + cp = CaseSensitiveConfigParser(delimiters=('=',)) + cp.read([path]) yield cp, distro def get_single(group, name, path=None): diff -Nru entrypoints-0.2.3/flit.ini entrypoints-0.3/flit.ini --- entrypoints-0.2.3/flit.ini 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/flit.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -[metadata] -module = entrypoints -author = Thomas Kluyver -author-email = thomas@kluyver.me.uk -home-page = https://github.com/takluyver/entrypoints -classifiers = License :: OSI Approved :: MIT License -requires-python = >=2.7 -requires = configparser (>=3.5); python_version == '2.7' diff -Nru entrypoints-0.2.3/pyproject.toml entrypoints-0.3/pyproject.toml --- entrypoints-0.2.3/pyproject.toml 1970-01-01 00:00:00.000000000 +0000 +++ entrypoints-0.3/pyproject.toml 2019-01-07 18:03:55.000000000 +0000 @@ -0,0 +1,20 @@ +[build-system] +requires = ["flit"] +build-backend = "flit.buildapi" + +[tool.flit.metadata] +module = "entrypoints" +author = "Thomas Kluyver" +author-email = "thomas@kluyver.me.uk" +home-page = "https://github.com/takluyver/entrypoints" +description-file = "README.rst" +classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3" +] +requires-python = ">=2.7" +requires = ["configparser (>=3.5); python_version == '2.7'"] + +[tool.flit.metadata.urls] +Documentation = "https://entrypoints.readthedocs.io/en/latest/" diff -Nru entrypoints-0.2.3/README.rst entrypoints-0.3/README.rst --- entrypoints-0.2.3/README.rst 1970-01-01 00:00:00.000000000 +0000 +++ entrypoints-0.3/README.rst 2019-01-07 18:03:55.000000000 +0000 @@ -0,0 +1,14 @@ +Entry points are a way for Python packages to advertise objects with some +common interface. The most common examples are ``console_scripts`` entry points, +which define shell commands by identifying a Python function to run. + +*Groups* of entry points, such as ``console_scripts``, point to objects with +similar interfaces. An application might use a group to find its plugins, or +multiple groups if it has different kinds of plugins. + +The **entrypoints** module contains functions to find and load entry points. +You can install it from PyPI with ``pip install entrypoints``. + +To advertise entry points when distributing a package, see +`entry_points in the Python Packaging User Guide +`_. diff -Nru entrypoints-0.2.3/tests/test_entrypoints.py entrypoints-0.3/tests/test_entrypoints.py --- entrypoints-0.2.3/tests/test_entrypoints.py 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/tests/test_entrypoints.py 2019-01-07 18:03:55.000000000 +0000 @@ -4,6 +4,7 @@ import os.path as osp import pytest import warnings +from zipfile import ZipFile import entrypoints @@ -35,8 +36,8 @@ assert ep.object_name == 'abc' ep2 = entrypoints.get_single('entrypoints.test1', 'njn', sample_path) - assert ep.module_name == 'foo' - assert ep.object_name == 'abc' + assert ep2.module_name == 'qux.extn' + assert ep2.object_name == 'Njn.load' def test_dot_prefix(): ep = entrypoints.get_single('blogtool.parsers', '.rst', sample_path) @@ -50,6 +51,26 @@ group = entrypoints.get_group_named('test.case_sensitive', sample_path) assert set(group.keys()) == {'Ptangle', 'ptangle'} +def test_load_zip(tmpdir): + whl_file = str(tmpdir / 'parmesan-1.2.whl') + with ZipFile(whl_file, 'w') as whl: + whl.writestr('parmesan-1.2.dist-info/entry_points.txt', + b'[entrypoints.test.inzip]\na = edam:gouda') + whl.writestr('gruyere-2!1b4.dev0.egg-info/entry_points.txt', + b'[entrypoints.test.inzip]\nb = wensleydale:gouda') + + ep = entrypoints.get_single('entrypoints.test.inzip', 'a', [str(whl_file)]) + assert ep.module_name == 'edam' + assert ep.object_name == 'gouda' + assert ep.distro.name == 'parmesan' + assert ep.distro.version == '1.2' + + ep2 = entrypoints.get_single('entrypoints.test.inzip', 'b', [str(whl_file)]) + assert ep2.module_name == 'wensleydale' + assert ep2.object_name == 'gouda' + assert ep2.distro.name == 'gruyere' + assert ep2.distro.version == '2!1b4.dev0' + def test_load(): ep = entrypoints.EntryPoint('get_ep', 'entrypoints', 'get_single', None) obj = ep.load() diff -Nru entrypoints-0.2.3/.travis.yml entrypoints-0.3/.travis.yml --- entrypoints-0.2.3/.travis.yml 2017-06-08 10:53:49.000000000 +0000 +++ entrypoints-0.3/.travis.yml 2019-01-07 18:03:55.000000000 +0000 @@ -1,7 +1,8 @@ language: python python: + - "3.6" + - "3.5" - "3.4" - - "3.3" - "2.7" install: - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install configparser; fi