Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-distlib for openSUSE:Factory checked in at 2023-08-09 17:24:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-distlib (Old) and /work/SRC/openSUSE:Factory/.python-distlib.new.11712 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-distlib" Wed Aug 9 17:24:08 2023 rev:13 rq:1102885 version:0.3.7 Changes: -------- --- /work/SRC/openSUSE:Factory/python-distlib/python-distlib.changes 2023-04-22 22:02:25.797922954 +0200 +++ /work/SRC/openSUSE:Factory/.python-distlib.new.11712/python-distlib.changes 2023-08-09 17:24:13.520996287 +0200 @@ -1,0 +2,17 @@ +Tue Aug 8 11:07:21 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.3.7: + * Handle newlines when parsing metadata. + * Use version comparison logic for python_full_version. + * Simplify code with a set comprehension. + * Fix shebang computation for source builds of Python. + * Extract tarfiles more safely by incorporating tarfile + filters. + * Check for 'has_cert' attribute before using it. + * Fix #203: Handle parsing of export entries to allow script + names such as "," or ",foo". + * Fix #200: Improve conformance to PEP440. + * In addition to the above, an SPDX license identifier is now + used. + +------------------------------------------------------------------- Old: ---- distlib-0.3.6.tar.gz New: ---- distlib-0.3.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-distlib.spec ++++++ --- /var/tmp/diff_new_pack.JKEHAZ/_old 2023-08-09 17:24:14.161000272 +0200 +++ /var/tmp/diff_new_pack.JKEHAZ/_new 2023-08-09 17:24:14.169000321 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?sle15_python_module_pythons} Name: python-distlib -Version: 0.3.6 +Version: 0.3.7 Release: 0 Summary: Distribution utilities License: Python-2.0 ++++++ distlib-0.3.6.tar.gz -> distlib-0.3.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/CHANGES.rst new/distlib-0.3.7/CHANGES.rst --- old/distlib-0.3.6/CHANGES.rst 2022-08-04 21:09:24.000000000 +0200 +++ new/distlib-0.3.7/CHANGES.rst 2023-07-17 11:59:32.000000000 +0200 @@ -1,11 +1,56 @@ Change log for ``distlib`` -------------------------- -0.3.6 (future) +0.3.8 (future) ~~~~~~~~~~~~~~ Released: Not yet. +0.3.7 +~~~~~ + +Released: 2023-07-17 + +- database + + - Handle newlines when parsing metadata. + +- markers + + - Use version comparison logic for python_full_version. Thanks to Albert + Peschar for the patch. + + - Simplify code with a set comprehension. Thanks to Christian Clauss for + the patch. + +- scripts + + - Fix shebang computation for source builds of Python. Thanks to Eli + Schwartz for the patch. + +- util + + - Extract tarfiles more safely by incorporating tarfile filters. Thanks to + Petr Viktorin for the patch. + + - Check for 'has_cert' attribute before using it. Thanks to Lumir Balhar for + the patch. + + - Fix #203: Handle parsing of export entries to allow script names such as + "," or ",foo". Thanks to Flavio Amurrio for the report. + +- versions + + - Fix #200: Improve conformance to PEP440. Thanks to GitHub user con-f-use + for the report. + +In addition to the above, an SPDX license identifier is now used. + +0.3.6 +~~~~~ + +Released: 2022-08-26 + - scripts - Fixed #175: Updated launcher executables to better handle the relationship @@ -987,7 +1032,7 @@ - metadata - - Added missing condition in :meth:`todict`. + - Added missing condition in :meth:`~distlib.metadata.Metadata.todict`. - scripts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/PKG-INFO new/distlib-0.3.7/PKG-INFO --- old/distlib-0.3.6/PKG-INFO 2022-08-26 11:31:09.000000000 +0200 +++ new/distlib-0.3.7/PKG-INFO 2023-07-17 12:09:03.000000000 +0200 @@ -1,11 +1,11 @@ Metadata-Version: 2.1 Name: distlib -Version: 0.3.6 +Version: 0.3.7 Summary: Distribution utilities Home-page: https://github.com/pypa/distlib Author: Vinay Sajip Author-email: vinay_sa...@red-dove.com -License: Python license +License: PSF-2.0 Project-URL: Documentation, https://distlib.readthedocs.io/ Project-URL: Source, https://github.com/pypa/distlib Project-URL: Tracker, https://github.com/pypa/distlib/issues diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/__init__.py new/distlib-0.3.7/distlib/__init__.py --- old/distlib-0.3.6/distlib/__init__.py 2022-08-26 11:05:41.000000000 +0200 +++ new/distlib-0.3.7/distlib/__init__.py 2023-07-17 12:02:46.000000000 +0200 @@ -6,7 +6,7 @@ # import logging -__version__ = '0.3.6' +__version__ = '0.3.7' class DistlibException(Exception): pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/database.py new/distlib-0.3.7/distlib/database.py --- old/distlib-0.3.6/distlib/database.py 2022-07-09 19:24:37.000000000 +0200 +++ new/distlib-0.3.7/distlib/database.py 2022-11-25 12:34:32.000000000 +0100 @@ -903,15 +903,18 @@ lines = data.splitlines() for line in lines: line = line.strip() - if line.startswith('['): + # sectioned files have bare newlines (separating sections) + if not line: # pragma: no cover + continue + if line.startswith('['): # pragma: no cover logger.warning('Unexpected line: quitting requirement scan: %r', line) break r = parse_requirement(line) - if not r: + if not r: # pragma: no cover logger.warning('Not recognised as a requirement: %r', line) continue - if r.extras: + if r.extras: # pragma: no cover logger.warning('extra requirements in requires.txt are ' 'not supported') if not r.constraints: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/manifest.py new/distlib-0.3.7/distlib/manifest.py --- old/distlib-0.3.6/distlib/manifest.py 2019-04-09 09:00:51.000000000 +0200 +++ new/distlib-0.3.7/distlib/manifest.py 2022-09-01 12:11:56.000000000 +0200 @@ -35,8 +35,9 @@ _PYTHON_VERSION = sys.version_info[:2] class Manifest(object): - """A list of files built by on exploring the filesystem and filtered by - applying various patterns to what we find there. + """ + A list of files built by exploring the filesystem and filtered by applying various + patterns to what we find there. """ def __init__(self, base=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/markers.py new/distlib-0.3.7/distlib/markers.py --- old/distlib-0.3.6/distlib/markers.py 2021-12-08 11:51:43.000000000 +0100 +++ new/distlib-0.3.7/distlib/markers.py 2022-10-31 21:08:21.000000000 +0100 @@ -24,6 +24,10 @@ __all__ = ['interpret'] _VERSION_PATTERN = re.compile(r'((\d+(\.\d+)*\w*)|\'(\d+(\.\d+)*\w*)\'|\"(\d+(\.\d+)*\w*)\")') +_VERSION_MARKERS = {'python_version', 'python_full_version'} + +def _is_version_marker(s): + return isinstance(s, string_types) and s in _VERSION_MARKERS def _is_literal(o): if not isinstance(o, string_types) or not o: @@ -31,14 +35,11 @@ return o[0] in '\'"' def _get_versions(s): - result = [] - for m in _VERSION_PATTERN.finditer(s): - result.append(NV(m.groups()[0])) - return set(result) + return {NV(m.groups()[0]) for m in _VERSION_PATTERN.finditer(s)} class Evaluator(object): """ - This class is used to evaluate marker expessions. + This class is used to evaluate marker expressions. """ operations = { @@ -80,11 +81,11 @@ lhs = self.evaluate(elhs, context) rhs = self.evaluate(erhs, context) - if ((elhs == 'python_version' or erhs == 'python_version') and + if ((_is_version_marker(elhs) or _is_version_marker(erhs)) and op in ('<', '<=', '>', '>=', '===', '==', '!=', '~=')): lhs = NV(lhs) rhs = NV(rhs) - elif elhs == 'python_version' and op in ('in', 'not in'): + elif _is_version_marker(elhs) and op in ('in', 'not in'): lhs = NV(lhs) rhs = _get_versions(rhs) result = self.operations[op](lhs, rhs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/metadata.py new/distlib-0.3.7/distlib/metadata.py --- old/distlib-0.3.6/distlib/metadata.py 2021-12-15 11:35:33.000000000 +0100 +++ new/distlib-0.3.7/distlib/metadata.py 2022-11-25 08:18:53.000000000 +0100 @@ -136,17 +136,9 @@ def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): - for marker in markers: - if marker in keys: - return True - return False - - keys = [] - for key, value in fields.items(): - if value in ([], 'UNKNOWN', None): - continue - keys.append(key) + return any(marker in keys for marker in markers) + keys = [key for key, value in fields.items() if value not in ([], 'UNKNOWN', None)] possible_versions = ['1.0', '1.1', '1.2', '1.3', '2.1', '2.2'] # 2.0 removed # first let's try to see if a field is not part of one of the version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/scripts.py new/distlib-0.3.7/distlib/scripts.py --- old/distlib-0.3.6/distlib/scripts.py 2022-05-06 10:38:13.000000000 +0200 +++ new/distlib-0.3.7/distlib/scripts.py 2022-11-07 09:11:10.000000000 +0100 @@ -168,15 +168,16 @@ executable = os.path.join(sysconfig.get_path('scripts'), 'python%s' % sysconfig.get_config_var('EXE')) else: # pragma: no cover - executable = os.path.join( - sysconfig.get_config_var('BINDIR'), - 'python%s%s' % (sysconfig.get_config_var('VERSION'), - sysconfig.get_config_var('EXE'))) - if not os.path.isfile(executable): + if os.name == 'nt': # for Python builds from source on Windows, no Python executables with # a version suffix are created, so we use python.exe executable = os.path.join(sysconfig.get_config_var('BINDIR'), 'python%s' % (sysconfig.get_config_var('EXE'))) + else: + executable = os.path.join( + sysconfig.get_config_var('BINDIR'), + 'python%s%s' % (sysconfig.get_config_var('VERSION'), + sysconfig.get_config_var('EXE'))) if options: executable = self._get_alternate_executable(executable, options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/util.py new/distlib-0.3.7/distlib/util.py --- old/distlib-0.3.6/distlib/util.py 2021-12-08 10:34:52.000000000 +0100 +++ new/distlib-0.3.7/distlib/util.py 2023-07-17 11:34:54.000000000 +0200 @@ -707,7 +707,7 @@ __hash__ = object.__hash__ -ENTRY_RE = re.compile(r'''(?P<name>(\w|[-.+])+) +ENTRY_RE = re.compile(r'''(?P<name>([^\[]\S*)) \s*=\s*(?P<callable>(\w+)([:\.]\w+)*) \s*(\[\s*(?P<flags>[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? ''', re.VERBOSE) @@ -1249,6 +1249,19 @@ for tarinfo in archive.getmembers(): if not isinstance(tarinfo.name, text_type): tarinfo.name = tarinfo.name.decode('utf-8') + + # Limit extraction of dangerous items, if this Python + # allows it easily. If not, just trust the input. + # See: https://docs.python.org/3/library/tarfile.html#extraction-filters + def extraction_filter(member, path): + """Run tarfile.tar_filter, but raise the expected ValueError""" + # This is only called if the current Python has tarfile filters + try: + return tarfile.tar_filter(member, path) + except tarfile.FilterError as exc: + raise ValueError(str(exc)) + archive.extraction_filter = extraction_filter + archive.extractall(dest_dir) finally: @@ -1435,7 +1448,7 @@ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) if hasattr(ssl, 'OP_NO_SSLv2'): context.options |= ssl.OP_NO_SSLv2 - if self.cert_file: + if getattr(self, 'cert_file', None): context.load_cert_chain(self.cert_file, self.key_file) kwargs = {} if self.ca_certs: @@ -1908,9 +1921,13 @@ if m: release = m.group() elif osname[:6] == 'darwin': - import _osx_support, distutils.sysconfig + import _osx_support + try: + from distutils import sysconfig + except ImportError: + import sysconfig osname, release, machine = _osx_support.get_platform_osx( - distutils.sysconfig.get_config_vars(), + sysconfig.get_config_vars(), osname, release, machine) return '%s-%s-%s' % (osname, release, machine) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib/version.py new/distlib-0.3.7/distlib/version.py --- old/distlib-0.3.6/distlib/version.py 2021-09-21 12:06:14.000000000 +0200 +++ new/distlib-0.3.7/distlib/version.py 2023-06-06 20:35:34.000000000 +0200 @@ -176,9 +176,9 @@ return self._string -PEP440_VERSION_RE = re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?' - r'(\.(post)(\d+))?(\.(dev)(\d+))?' - r'(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$') +PEP440_VERSION_RE = re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|alpha|b|beta|c|rc|pre|preview)(\d+)?)?' + r'(\.(post|r|rev)(\d+)?)?([._-]?(dev)(\d+)?)?' + r'(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$', re.I) def _pep_440_key(s): @@ -202,15 +202,24 @@ if pre == (None, None): pre = () else: - pre = pre[0], int(pre[1]) + if pre[1] is None: + pre = pre[0], 0 + else: + pre = pre[0], int(pre[1]) if post == (None, None): post = () else: - post = post[0], int(post[1]) + if post[1] is None: + post = post[0], 0 + else: + post = post[0], int(post[1]) if dev == (None, None): dev = () else: - dev = dev[0], int(dev[1]) + if dev[1] is None: + dev = dev[0], 0 + else: + dev = dev[0], int(dev[1]) if local is None: local = () else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib.egg-info/PKG-INFO new/distlib-0.3.7/distlib.egg-info/PKG-INFO --- old/distlib-0.3.6/distlib.egg-info/PKG-INFO 2022-08-26 11:31:08.000000000 +0200 +++ new/distlib-0.3.7/distlib.egg-info/PKG-INFO 2023-07-17 12:09:03.000000000 +0200 @@ -1,11 +1,11 @@ Metadata-Version: 2.1 Name: distlib -Version: 0.3.6 +Version: 0.3.7 Summary: Distribution utilities Home-page: https://github.com/pypa/distlib Author: Vinay Sajip Author-email: vinay_sa...@red-dove.com -License: Python license +License: PSF-2.0 Project-URL: Documentation, https://distlib.readthedocs.io/ Project-URL: Source, https://github.com/pypa/distlib Project-URL: Tracker, https://github.com/pypa/distlib/issues diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/distlib.egg-info/SOURCES.txt new/distlib-0.3.7/distlib.egg-info/SOURCES.txt --- old/distlib-0.3.6/distlib.egg-info/SOURCES.txt 2022-08-26 11:31:08.000000000 +0200 +++ new/distlib-0.3.7/distlib.egg-info/SOURCES.txt 2023-07-17 12:09:03.000000000 +0200 @@ -48,6 +48,7 @@ tests/compat.py tests/distlib_tests.py tests/dummy-0.1-py27-none-any.whl +tests/evil.tar.gz tests/foo.zip tests/good.bin tests/good.bin.asc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/setup.cfg new/distlib-0.3.7/setup.cfg --- old/distlib-0.3.6/setup.cfg 2022-08-26 11:31:09.000000000 +0200 +++ new/distlib-0.3.7/setup.cfg 2023-07-17 12:09:03.000000000 +0200 @@ -6,8 +6,8 @@ url = https://github.com/pypa/distlib author = Vinay Sajip author_email = vinay_sa...@red-dove.com -license = Python license -license_file = LICENSE.txt +license = PSF-2.0 +license_files = LICENSE.txt classifiers = Development Status :: 5 - Production/Stable Environment :: Console Binary files old/distlib-0.3.6/tests/evil.tar.gz and new/distlib-0.3.7/tests/evil.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/tests/test_database.py new/distlib-0.3.7/tests/test_database.py --- old/distlib-0.3.6/tests/test_database.py 2020-09-18 12:49:35.000000000 +0200 +++ new/distlib-0.3.7/tests/test_database.py 2022-11-25 09:28:38.000000000 +0100 @@ -578,8 +578,9 @@ self.assertIn('real', d) e = d['real'] self.check_entry(e, 'real', 'cgi', 'print_directory', []) - import cgi - self.assertIs(e.value, cgi.print_directory) + if sys.version_info[:2] < (3, 12): + import cgi + self.assertIs(e.value, cgi.print_directory) # See issue #78. Test reading an entry_points.txt with leading spaces diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/tests/test_index.py new/distlib-0.3.7/tests/test_index.py --- old/distlib-0.3.6/tests/test_index.py 2021-12-18 15:23:15.000000000 +0100 +++ new/distlib-0.3.7/tests/test_index.py 2022-11-25 09:33:34.000000000 +0100 @@ -309,6 +309,7 @@ self.addCleanup(cleanup) return server + @unittest.skipIf(sys.version_info[:2] > (3, 11), 'Temporary skip') def test_ssl_verification(self): certfile = os.path.join(HERE, 'keycert.pem') server = self.make_https_server(certfile) @@ -319,6 +320,7 @@ self.assertEqual(response.code, 200) @unittest.skipIf(IN_GITHUB_WORKFLOW, 'This test is end-of-line dependent') + @unittest.skipIf(sys.version_info[:2] > (3, 11), 'Temporary skip') def test_download(self): # pragma: no cover digest = '913093474942c5a564c011f232868517' # for testsrc/README.txt certfile = os.path.join(HERE, 'keycert.pem') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/tests/test_locators.py new/distlib-0.3.7/tests/test_locators.py --- old/distlib-0.3.6/tests/test_locators.py 2021-12-12 20:18:32.000000000 +0100 +++ new/distlib-0.3.7/tests/test_locators.py 2023-06-06 20:11:10.000000000 +0200 @@ -233,6 +233,7 @@ @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online test') @unittest.skipUnless(ssl, 'SSL required for this test.') + @unittest.skipIf(True, 'Optimised metadata is not up-to-date') def test_dependency_finder(self): locator = AggregatingLocator( JSONLocator(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/tests/test_markers.py new/distlib-0.3.7/tests/test_markers.py --- old/distlib-0.3.6/tests/test_markers.py 2021-12-08 10:58:39.000000000 +0100 +++ new/distlib-0.3.7/tests/test_markers.py 2022-10-31 21:08:22.000000000 +0100 @@ -78,6 +78,12 @@ self.assertTrue(interpret( "'buuuu' not in os_name and '%s' in os_name" % os_name)) + # normalized version comparison correctness + self.assertTrue(interpret('python_version > "5.0"', {'python_version': '10.0'})) + self.assertTrue(interpret('python_version == "5.0"', {'python_version': '5.0'})) + self.assertTrue(interpret('python_version < "5.0"', {'python_version': '5.0b0'})) + self.assertTrue(interpret('python_full_version > "5.0"', {'python_full_version': '10.0'})) + # execution context self.assertTrue(interpret('python_version == "0.1"', {'python_version': '0.1'})) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/tests/test_util.py new/distlib-0.3.7/tests/test_util.py --- old/distlib-0.3.6/tests/test_util.py 2022-05-09 08:33:19.000000000 +0200 +++ new/distlib-0.3.7/tests/test_util.py 2023-07-17 11:13:14.000000000 +0200 @@ -74,6 +74,12 @@ self.check_entry(get_export_entry('foo=abc'), 'foo', 'abc', None, []) self.check_entry(get_export_entry('smc++ = smcpp.frontend:console'), 'smc++', 'smcpp.frontend', 'console', []) + # See issue #203 - correct name parsing to allow non-name-like names like "," + self.check_entry(get_export_entry(', = comma:main'), ',', + 'comma', 'main', []) + self.check_entry(get_export_entry(',comma = comma:main'), ',comma', + 'comma', 'main', []) + self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x:y') self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x [') self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x ]') @@ -471,6 +477,10 @@ ) bad_archives = ('bad.zip', 'bad.tar', 'bad.tar.gz', 'bad.tar.bz2') + # Test "evil" tarball on 3.12 *or* on Python with PEP-706 backported + if sys.version_info > (3, 12) or hasattr(tarfile, 'data_filter'): + bad_archives += ('evil.tar.gz',) + for name, cls, mode, lister in good_archives: td = tempfile.mkdtemp() archive = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distlib-0.3.6/tests/test_version.py new/distlib-0.3.7/tests/test_version.py --- old/distlib-0.3.6/tests/test_version.py 2021-12-14 21:01:59.000000000 +0100 +++ new/distlib-0.3.7/tests/test_version.py 2023-06-06 20:46:54.000000000 +0200 @@ -54,14 +54,19 @@ self.assertEqual(set([NV('1.0')]), set([NV('1.0'), NV('1.0')])) def test_unsupported_versions(self): - unsupported = ('1.2a', '1.2.3b', + unsupported = ( + # '1.2a', '1.2.3b', # see issue 200 - not unsupported #'1.02', '1.2a03', '1.2a3.04', - '1.2.dev.2', '1.2dev', '1.2.dev', + '1.2.dev.2', + # '1.2dev', '1.2.dev', # see issue 200 - these are not unsupported '1.2-', '1.2-a', '1.2.dev2.post2', '1.2.post2.dev3.post4') for s in unsupported: - self.assertRaises(UnsupportedVersionError, NV, s) + with self.assertRaises(UnsupportedVersionError) as cm: + NV(s) + # print(s) + # import pdb; pdb.set_trace() def test_huge_version(self): self.assertEqual(str(NV('1980.0')), '1980.0') @@ -176,23 +181,23 @@ self.assertEqual(suggest('v1.0'), 'v1.0') # from setuptools - self.assertEqual(suggest('0.4a1.r10'), '0.4a1.post10') + # self.assertEqual(suggest('0.4a1.r10'), '0.4a1.post10') # see issue #200 self.assertEqual(suggest('0.7a1dev-r66608'), '0.7a1.dev66608') self.assertEqual(suggest('0.6a9.dev-r41475'), '0.6a9.dev41475') - self.assertEqual(suggest('2.4preview1'), '2.4c1') - self.assertEqual(suggest('2.4pre1'), '2.4c1') + # self.assertEqual(suggest('2.4preview1'), '2.4c1') # see issue #200 + # self.assertEqual(suggest('2.4pre1'), '2.4c1') # see issue #200 self.assertEqual(suggest('2.1-rc2'), '2.1c2') # from pypi - self.assertEqual(suggest('0.1dev'), '0.1.dev0') - self.assertEqual(suggest('0.1.dev'), '0.1.dev0') + # self.assertEqual(suggest('0.1dev'), '0.1.dev0') # see issue 200 - 0.1dev is now rational + # self.assertEqual(suggest('0.1.dev'), '0.1.dev0') # see issue 200 - 0.1.dev is now rational # we want to be able to parse Twisted # development versions are like post releases in Twisted #self.assertEqual(suggest('9.0.0+r2363'), '9.0.0.post2363') # pre-releases are using markers like "pre1" - self.assertEqual(suggest('9.0.0pre1'), '9.0.0c1') + # self.assertEqual(suggest('9.0.0pre1'), '9.0.0c1') # see issue #200 # we want to be able to parse Tcl-TK # they us "p1" "p2" for post releases @@ -448,6 +453,14 @@ s = 'foo (== %s)' % v self.assertRaises((SyntaxError, ValueError), NM, s) + def test_fix_200(self): + versions = ( + ('foo<=0.8.1dev', '0.8.1.dev0'), + ) + + for v1, v2 in versions: + # import pdb; pdb.set_trace() + NM(v1).match(v2) class LegacyVersionTestCase(DistlibTestCase): # These tests are the same as distribute's