Hello community, here is the log from the commit of package python-py2pack for openSUSE:Factory checked in at 2020-10-27 19:01:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-py2pack (Old) and /work/SRC/openSUSE:Factory/.python-py2pack.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-py2pack" Tue Oct 27 19:01:31 2020 rev:49 rq:844232 version:0.8.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-py2pack/python-py2pack.changes 2019-03-29 20:42:31.674678504 +0100 +++ /work/SRC/openSUSE:Factory/.python-py2pack.new.3463/python-py2pack.changes 2020-10-27 19:01:47.406867446 +0100 @@ -1,0 +2,38 @@ +Tue Oct 27 09:06:41 UTC 2020 - Thomas Bechtold <[email protected]> + +- update to 0.8.5: + * Use 3.8 python in the travis by default + * Use python 3.8 and 3.9 in tox + * Execute flake8 on latest py3 instead of old py2 version + * Add missing comment to opensuse template header + * Switch to pytest + * Just say we support py2 and py3 do not bother with minor versions + * gitignore coverage datafile + * Do not bother with creating group tag as it is optional these days in openSUSE + * Run tests under python 3.7 and fix tests + * tests: replace year in tests by placeholder + * bug: show help if no command given + * Fix date in test examples + * fix fedora tests + * fix opensuse tests + * Update py2pack-opensuse-legacy.spec + * Update py2pack-opensuse.spec + * Make template compatible with spec-cleaner + * Add default empty for scripts + * Just get rid of whole line in opensuse-legacy.spec, this breaks things + * Don't add BR on python-devel without thinking + * Add test for non-existent file + * Add documentation to py2pack/utils.py + * Add test with invalid archive + * Raise a ValueError from \_get\_archive\_filelist instead of Exception + * Add type hints to py2pack.utils + * Ignore flake8 unused import warning for typing imports + * Require typing module for python < 3.5 + * Bump python version in test case + * Shorten overlong line + * Add docstrings & type hints to functions in requires.py + * Replace filter() with list/generator expressions + * Fix indentation of \_requirement\_find\_lowest\_possible + * Fix DeprecationWarnings for invalid escape sequences with python3 + +------------------------------------------------------------------- Old: ---- py2pack-0.8.4.tar.gz New: ---- py2pack-0.8.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-py2pack.spec ++++++ --- /var/tmp/diff_new_pack.2Xookq/_old 2020-10-27 19:01:48.414868180 +0100 +++ /var/tmp/diff_new_pack.2Xookq/_new 2020-10-27 19:01:48.422868185 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-py2pack # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-py2pack -Version: 0.8.4 +Version: 0.8.5 Release: 0 Summary: Script for generating distribution packages from Python packages on PyPI License: Apache-2.0 ++++++ py2pack-0.8.4.tar.gz -> py2pack-0.8.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/.travis.yml new/py2pack-0.8.5/.travis.yml --- old/py2pack-0.8.4/.travis.yml 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/.travis.yml 2020-10-27 09:59:12.000000000 +0100 @@ -2,9 +2,11 @@ language: python matrix: include: - - python: 2.7 + - python: 3.8 env: TOX_ENV=pep8 - - python: 2.7 + - python: 3.8 + env: TOX_ENV=py38 + - python: 3.8 env: TOX_ENV=docs - python: 2.7 env: TOX_ENV=py27 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/AUTHORS new/py2pack-0.8.5/AUTHORS --- old/py2pack-0.8.4/AUTHORS 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/AUTHORS 2020-10-27 09:59:45.000000000 +0100 @@ -1,11 +1,18 @@ Adam Spiers <[email protected]> Antonio Larrosa <[email protected]> +Christopher Yeleighton <[email protected]> +Dan Čermák <[email protected]> Dirk Mueller <[email protected]> Karol Babioch <[email protected]> -Lukas Wunner <[email protected]> Manuel Schnitzer <[email protected]> +Markéta Calábková <[email protected]> +Matěj Cepl <[email protected]> +MeggyCal <[email protected]> Oliver Kurz <[email protected]> Sascha Peilicke <[email protected]> Sascha Peilicke <[email protected]> Sebastian Wagner <[email protected]> Thomas Bechtold <[email protected]> +Tomáš Chvátal <[email protected]> +Tomáš Chvátal <[email protected]> +iyuroch <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/ChangeLog new/py2pack-0.8.5/ChangeLog --- old/py2pack-0.8.4/ChangeLog 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/ChangeLog 2020-10-27 09:59:45.000000000 +0100 @@ -1,6 +1,43 @@ CHANGES ======= +0.8.5 +----- + +* Use 3.8 python in the travis by default +* Use python 3.8 and 3.9 in tox +* Execute flake8 on latest py3 instead of old py2 version +* Add missing comment to opensuse template header +* Switch to pytest +* Just say we support py2 and py3 do not bother with minor versions +* gitignore coverage datafile +* Do not bother with creating group tag as it is optional these days in openSUSE +* Run tests under python 3.7 and fix tests +* tests: replace year in tests by placeholder +* bug: show help if no command given +* Fix date in test examples +* fix fedora tests +* fix opensuse tests +* Update py2pack-opensuse-legacy.spec +* Update py2pack-opensuse.spec +* Make template compatible with spec-cleaner +* Add default empty for scripts +* Just get rid of whole line in opensuse-legacy.spec, this breaks things +* Don't add BR on python-devel without thinking +* Add test for non-existent file +* Add documentation to py2pack/utils.py +* Add test with invalid archive +* Raise a ValueError from \_get\_archive\_filelist instead of Exception +* Add type hints to py2pack.utils +* Ignore flake8 unused import warning for typing imports +* Require typing module for python < 3.5 +* Bump python version in test case +* Shorten overlong line +* Add docstrings & type hints to functions in requires.py +* Replace filter() with list/generator expressions +* Fix indentation of \_requirement\_find\_lowest\_possible +* Fix DeprecationWarnings for invalid escape sequences with python3 + 0.8.4 ----- @@ -126,8 +163,6 @@ * Fix minimal version detection for requirements * Support requirement markers * Fix tests\_require handling -* Adjust some comments -* Use xmlrpc\_client from six * Adjust docs for testing * Remove whitespaces from README @@ -141,31 +176,12 @@ * Also collect tests\_require metadata * Remove distutils cleanup command * Remove pypip.in images from README -* Use distutils command when running setup.py -* Add contextmanager to extract a zip/tar into a tempdir -* Remove bitdeli image from README * Relicense under Apache-2.0 * Move setup.py sandbox run to extra file * Also parse entry\_points when given as dict -* Use a "fake" unicode literal from six for decoding -* Move setup.py parsing to extra file -* tox: Add possibility to run single test cases -* Ignore .eggs/ dir in git -* Update the SPDX mapping file -* Remove python 2.6 support -* travis: remove --use-mirrors pip flag usage -* tests: ignore console\_scripts order during tests -* Add python 3.4 and 3.5 support * Fix company name in spec template 0.5.0 ----- * Bump version to 0.5.0 -* Fix flake8 issues -* Fix console\_script handling -* Sanitize collected requirements -* Remove unused 'requires' from opensuse template -* Quote %doc filenames if they contain shell metacharacters -* Add support for "entry\_points" and "console\_scripts" parameters -* Adjust Travis CI build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/PKG-INFO new/py2pack-0.8.5/PKG-INFO --- old/py2pack-0.8.4/PKG-INFO 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/PKG-INFO 2020-10-27 09:59:45.669325400 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: py2pack -Version: 0.8.4 +Version: 0.8.5 Summary: Generate distribution packages from PyPI Home-page: http://github.com/openSUSE/py2pack Author: Sascha Peilicke, Thomas Bechtold @@ -116,11 +116,11 @@ $ tox -epy27 test.test_py2pack:Py2packTestCase - You can also run `nose`_ directly: + You can also run `pytest`_ directly: .. code-block:: bash - $ nosetests + $ pytest It assumes you have the test dependencies installed (available on PYTHONPATH) on your system. @@ -135,10 +135,10 @@ .. _openSUSE: http://www.opensuse.org/en/ .. _RPM: http://en.wikipedia.org/wiki/RPM_Package_Manager .. _DEB: http://en.wikipedia.org/wiki/Deb_(file_format) - .. _`Python Package Index`: https://pypi.python.org/pypi/rapport - .. _`Open Build Service`: https://build.opensuse.org/package/show?package=rapport&project=devel:languages:python + .. _`Python Package Index`: https://pypi.org/ + .. _`Open Build Service`: https://build.opensuse.org/package/show/devel:languages:python/python-py2pack .. _`the repository`: https://github.com/openSUSE/py2pack - .. _`nose`: https://nose.readthedocs.org + .. _`pytest`: https://github.com/pytest-dev/pytest .. _`tox`: http://testrun.org/tox @@ -150,11 +150,7 @@ Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Software Development :: Code Generators Classifier: Topic :: Software Development :: Pre-processors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/README.rst new/py2pack-0.8.5/README.rst --- old/py2pack-0.8.4/README.rst 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/README.rst 2020-10-27 09:59:12.000000000 +0100 @@ -108,11 +108,11 @@ $ tox -epy27 test.test_py2pack:Py2packTestCase -You can also run `nose`_ directly: +You can also run `pytest`_ directly: .. code-block:: bash - $ nosetests + $ pytest It assumes you have the test dependencies installed (available on PYTHONPATH) on your system. @@ -127,9 +127,9 @@ .. _openSUSE: http://www.opensuse.org/en/ .. _RPM: http://en.wikipedia.org/wiki/RPM_Package_Manager .. _DEB: http://en.wikipedia.org/wiki/Deb_(file_format) -.. _`Python Package Index`: https://pypi.python.org/pypi/rapport -.. _`Open Build Service`: https://build.opensuse.org/package/show?package=rapport&project=devel:languages:python +.. _`Python Package Index`: https://pypi.org/ +.. _`Open Build Service`: https://build.opensuse.org/package/show/devel:languages:python/python-py2pack .. _`the repository`: https://github.com/openSUSE/py2pack -.. _`nose`: https://nose.readthedocs.org +.. _`pytest`: https://github.com/pytest-dev/pytest .. _`tox`: http://testrun.org/tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack/__init__.py new/py2pack-0.8.5/py2pack/__init__.py --- old/py2pack-0.8.4/py2pack/__init__.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/py2pack/__init__.py 2020-10-27 09:59:12.000000000 +0100 @@ -142,15 +142,15 @@ def _quote_shell_metacharacters(string): - shell_metachars_re = re.compile("[|&;()<>\s]") + shell_metachars_re = re.compile(r"[|&;()<>\s]") if re.search(shell_metachars_re, string): return "'" + string + "'" return string def _augment_data_from_tarball(args, filename, data): - docs_re = re.compile("{0}-{1}\/((?:AUTHOR|ChangeLog|CHANGES|NEWS|README).*)".format(args.name, args.version), re.IGNORECASE) - license_re = re.compile("{0}-{1}\/((?:COPYING|LICENSE).*)".format(args.name, args.version), re.IGNORECASE) + docs_re = re.compile(r"{0}-{1}\/((?:AUTHOR|ChangeLog|CHANGES|NEWS|README).*)".format(args.name, args.version), re.IGNORECASE) + license_re = re.compile(r"{0}-{1}\/((?:COPYING|LICENSE).*)".format(args.name, args.version), re.IGNORECASE) data_archive = meta_utils.from_archive(filename) data.update(data_archive['data']) @@ -241,7 +241,7 @@ data['source_url'] = args.name + '-' + args.version + '.zip' data['year'] = datetime.datetime.now().year # set current year data['user_name'] = pwd.getpwuid(os.getuid())[4] # set system user (packager) - data['summary_no_ending_dot'] = re.sub('(.*)\.', '\g<1>', data.get('summary', "")) + data['summary_no_ending_dot'] = re.sub(r'(.*)\.', r'\g<1>', data.get('summary', "")) tarball_file = glob.glob("{0}-{1}.*".format(args.name, args.version)) # also check tarball files with underscore. Some packages have a name with @@ -347,6 +347,8 @@ transport.set_proxy(args.proxy) pypi._ServerProxy__transport = transport # Evil, but should do the trick + if 'func' not in args: + sys.exit(parser.print_help()) args.func(args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack/requires.py new/py2pack-0.8.5/py2pack/requires.py --- old/py2pack-0.8.4/py2pack/requires.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/py2pack/requires.py 2020-10-27 09:59:12.000000000 +0100 @@ -15,48 +15,105 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" Module for handling entries from requirements.txt + +This module contains internal functions to sanitize requirement entries and +bring them into a form that can be directly included in a spec file. + +For further information concerning requirements (and markers), see `PEP 508 +<https://www.python.org/dev/peps/pep-0508/>`. For versions, see `PEP 440 +<https://www.python.org/dev/peps/pep-0440/>` +""" + from __future__ import absolute_import from __future__ import print_function +from typing import List, Optional # noqa: F401, pylint: disable=unused-import import sys import pkg_resources -from six.moves import filter from six.moves import map def _requirement_filter_by_marker(req): - """check if the requirement is satisfied by the marker""" + # type: (pkg_resources.Requirement) -> bool + """Check if the requirement is satisfied by the marker. + + This function checks for a given Requirement whether its environment marker + is satisfied on the current platform. Currently only the python version and + system platform are checked. + """ if hasattr(req, 'marker') and req.marker: - marker_env = {'python_version': '.'.join(map(str, sys.version_info[:2])), 'sys_platform': sys.platform} + marker_env = { + 'python_version': '.'.join(map(str, sys.version_info[:2])), + 'sys_platform': sys.platform + } if not req.marker.evaluate(environment=marker_env): return False return True def _requirement_find_lowest_possible(req): - """ find lowest required version""" - version_dep = None - version_comp = None - for dep in req.specs: - version = pkg_resources.parse_version(dep[1]) - # we don't want to have a not supported version as minimal version - if dep[0] == '!=': - continue - # try to use the lowest version available - # i.e. for ">=0.8.4,>=0.9.7", select "0.8.4" - if (not version_dep or - version < pkg_resources.parse_version(version_dep)): - version_dep = dep[1] - version_comp = dep[0] - return filter(lambda x: x is not None, - [req.unsafe_name, version_comp, version_dep]) + # type: (pkg_resources.Requirement) -> List[str] + """Find lowest required version. + + Given a single Requirement, this function calculates the lowest required + version to satisfy it. If the requirement excludes a specific version, then + this version will not be used as the minimal supported version. + + Examples + -------- + + >>> req = pkg_resources.Requirement.parse("foobar>=1.0,>2") + >>> _requirement_find_lowest_possible(req) + ['foobar', '>=', '1.0'] + >>> req = pkg_resources.Requirement.parse("baz>=1.3,>3,!=1.5") + >>> _requirement_find_lowest_possible(req) + ['baz', '>=', '1.3'] + + """ + version_dep = None # type: Optional[str] + version_comp = None # type: Optional[str] + for dep in req.specs: + version = pkg_resources.parse_version(dep[1]) + # we don't want to have a not supported version as minimal version + if dep[0] == '!=': + continue + # try to use the lowest version available + # i.e. for ">=0.8.4,>=0.9.7", select "0.8.4" + if (not version_dep or + version < pkg_resources.parse_version(version_dep)): + version_dep = dep[1] + version_comp = dep[0] + + assert (version_dep is None and version_comp is None) or \ + (version_dep is not None and version_comp is not None) + + return [ + x for x in (req.unsafe_name, version_comp, version_dep) + if x is not None] def _requirements_sanitize(req_list): - filtered_req_list = map( - _requirement_find_lowest_possible, filter( - _requirement_filter_by_marker, - map(lambda x: pkg_resources.Requirement.parse(x), req_list) - ) + # type: (List[str]) -> List[str] + """ + Cleanup a list of requirement strings (e.g. from requirements.txt) to only + contain entries valid for this platform and with the lowest required version + only. + + Example + ------- + + >>> from sys import version_info + >>> _requirements_sanitize([ + ... 'foo>=3.0', + ... "monotonic>=1.0,>0.1;python_version=='2.4'", + ... "bar>1.0;python_version=='{}.{}'".format(version_info[0], version_info[1]) + ... ]) + ['foo >= 3.0', 'bar > 1.0'] + """ + filtered_req_list = ( + _requirement_find_lowest_possible(req) for req in + (pkg_resources.Requirement.parse(s) for s in req_list) + if _requirement_filter_by_marker(req) ) return [" ".join(req) for req in filtered_req_list] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack/templates/fedora.spec new/py2pack-0.8.5/py2pack/templates/fedora.spec --- old/py2pack-0.8.4/py2pack/templates/fedora.spec 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/py2pack/templates/fedora.spec 2020-10-27 09:59:12.000000000 +0100 @@ -7,10 +7,9 @@ Name: python-{{ name }} Version: {{ version }} Release: 0 -Url: {{ home_page }} Summary: {{ summary }} License: {{ license }} -Group: Development/Languages/Python +URL: {{ home_page }} Source: {{ source_url|replace(version, '%{version}') }} BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel {%- if requires_python %} = {{ requires_python }} {% endif %} @@ -53,7 +52,7 @@ {%- if doc_files %} %doc {{ doc_files|join(" ") }} {%- endif %} -{%- for script in scripts %} +{%- for script in scripts|default([], true) %} %{_bindir}/{{ script }} {%- endfor %} %{python_sitelib}/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack/templates/opensuse-legacy.spec new/py2pack-0.8.5/py2pack/templates/opensuse-legacy.spec --- old/py2pack-0.8.4/py2pack/templates/opensuse-legacy.spec 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/py2pack/templates/opensuse-legacy.spec 2020-10-27 09:59:12.000000000 +0100 @@ -12,18 +12,16 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ Name: python-{{ name }} Version: {{ version }} Release: 0 -License: {{ license }} Summary: {{ summary_no_ending_dot|default(summary, true) }} -Url: {{ home_page }} -Group: Development/Languages/Python +License: {{ license }} +URL: {{ home_page }} Source: {{ source_url|replace(version, '%{version}') }} -BuildRequires: python-devel {%- if requires_python %} = {{ requires_python }} {% endif %} BuildRequires: python-setuptools {%- if install_requires and install_requires is not none %} {%- for req in install_requires|sort %} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack/templates/opensuse.spec new/py2pack-0.8.5/py2pack/templates/opensuse.spec --- old/py2pack-0.8.4/py2pack/templates/opensuse.spec 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/py2pack/templates/opensuse.spec 2020-10-27 09:59:12.000000000 +0100 @@ -12,20 +12,19 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-{{ name }} Version: {{ version }} Release: 0 -License: {{ license }} Summary: {{ summary_no_ending_dot|default(summary, true) }} -Url: {{ home_page }} -Group: Development/Languages/Python +License: {{ license }} +URL: {{ home_page }} Source: {{ source_url|replace(version, '%{version}') }} BuildRequires: python-rpm-macros -BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} {%- if setup_requires and setup_requires is not none %} {%- for req in setup_requires|sort %} @@ -65,7 +64,6 @@ {%- if not has_ext_modules %} BuildArch: noarch {%- endif %} - %python_subpackages %description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack/utils.py new/py2pack-0.8.5/py2pack/utils.py --- old/py2pack-0.8.4/py2pack/utils.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/py2pack/utils.py 2020-10-27 09:59:12.000000000 +0100 @@ -15,21 +15,39 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Module containing utility functions that fit nowhere else.""" + +from typing import List # noqa: F401, pylint: disable=unused-import + import tarfile import zipfile def _get_archive_filelist(filename): - names = [] + # type: (str) -> List[str] + """Extract the list of files from a tar or zip archive. + + Args: + filename: name of the archive + + Returns: + Sorted list of files in the archive, excluding './' + + Raises: + ValueError: when the file is neither a zip nor a tar archive + FileNotFoundError: when the provided file does not exist (for Python 3) + IOError: when the provided file does not exist (for Python 2) + """ + names = [] # type: List[str] if tarfile.is_tarfile(filename): - with tarfile.open(filename) as f: - names = sorted(f.getnames()) + with tarfile.open(filename) as tar_file: + names = sorted(tar_file.getnames()) elif zipfile.is_zipfile(filename): - with zipfile.ZipFile(filename) as f: - names = sorted(f.namelist()) + with zipfile.ZipFile(filename) as zip_file: + names = sorted(zip_file.namelist()) else: - raise Exception("Can not get filenames from '%s'. " - "Not a tar or zip file" % filename) + raise ValueError("Can not get filenames from '{!s}'. " + "Not a tar or zip file".format(filename)) if "./" in names: names.remove("./") return names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack.egg-info/PKG-INFO new/py2pack-0.8.5/py2pack.egg-info/PKG-INFO --- old/py2pack-0.8.4/py2pack.egg-info/PKG-INFO 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/py2pack.egg-info/PKG-INFO 2020-10-27 09:59:45.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: py2pack -Version: 0.8.4 +Version: 0.8.5 Summary: Generate distribution packages from PyPI Home-page: http://github.com/openSUSE/py2pack Author: Sascha Peilicke, Thomas Bechtold @@ -116,11 +116,11 @@ $ tox -epy27 test.test_py2pack:Py2packTestCase - You can also run `nose`_ directly: + You can also run `pytest`_ directly: .. code-block:: bash - $ nosetests + $ pytest It assumes you have the test dependencies installed (available on PYTHONPATH) on your system. @@ -135,10 +135,10 @@ .. _openSUSE: http://www.opensuse.org/en/ .. _RPM: http://en.wikipedia.org/wiki/RPM_Package_Manager .. _DEB: http://en.wikipedia.org/wiki/Deb_(file_format) - .. _`Python Package Index`: https://pypi.python.org/pypi/rapport - .. _`Open Build Service`: https://build.opensuse.org/package/show?package=rapport&project=devel:languages:python + .. _`Python Package Index`: https://pypi.org/ + .. _`Open Build Service`: https://build.opensuse.org/package/show/devel:languages:python/python-py2pack .. _`the repository`: https://github.com/openSUSE/py2pack - .. _`nose`: https://nose.readthedocs.org + .. _`pytest`: https://github.com/pytest-dev/pytest .. _`tox`: http://testrun.org/tox @@ -150,11 +150,7 @@ Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Software Development :: Code Generators Classifier: Topic :: Software Development :: Pre-processors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack.egg-info/pbr.json new/py2pack-0.8.5/py2pack.egg-info/pbr.json --- old/py2pack-0.8.4/py2pack.egg-info/pbr.json 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/py2pack.egg-info/pbr.json 2020-10-27 09:59:45.000000000 +0100 @@ -1 +1 @@ -{"git_version": "433bd8b", "is_release": true} \ No newline at end of file +{"git_version": "d9adb54", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/py2pack.egg-info/requires.txt new/py2pack-0.8.5/py2pack.egg-info/requires.txt --- old/py2pack-0.8.4/py2pack.egg-info/requires.txt 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/py2pack.egg-info/requires.txt 2020-10-27 09:59:45.000000000 +0100 @@ -2,3 +2,6 @@ setuptools six metaextract + +[:(python_version<'3.5')] +typing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/requirements.txt new/py2pack-0.8.5/requirements.txt --- old/py2pack-0.8.4/requirements.txt 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/requirements.txt 2020-10-27 09:59:12.000000000 +0100 @@ -2,3 +2,4 @@ setuptools six metaextract +typing;python_version<'3.5' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/setup.cfg new/py2pack-0.8.5/setup.cfg --- old/py2pack-0.8.4/setup.cfg 2018-12-06 20:56:38.000000000 +0100 +++ new/py2pack-0.8.5/setup.cfg 2020-10-27 09:59:45.673327200 +0100 @@ -14,12 +14,8 @@ Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX - Programming Language :: Python - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3.3 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 + Programming Language :: Python :: 2 + Programming Language :: Python :: 3 Topic :: Software Development :: Code Generators Topic :: Software Development :: Pre-processors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/setup.py new/py2pack-0.8.5/setup.py --- old/py2pack-0.8.4/setup.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/setup.py 2020-10-27 09:59:12.000000000 +0100 @@ -18,15 +18,6 @@ import setuptools -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - setuptools.setup(setup_requires=['pbr>=1.8'], pbr=True, - test_suite='test', ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test/examples/py2pack-fedora.spec new/py2pack-0.8.5/test/examples/py2pack-fedora.spec --- old/py2pack-0.8.4/test/examples/py2pack-fedora.spec 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test/examples/py2pack-fedora.spec 2020-10-27 09:59:12.000000000 +0100 @@ -1,16 +1,15 @@ # # spec file for package python-py2pack # -# Copyright (c) 2018 __USER__. +# Copyright (c) __YEAR__ __USER__. # Name: python-py2pack Version: 0.8.0 Release: 0 -Url: http://github.com/openSUSE/py2pack Summary: Generate distribution packages from PyPI License: Apache-2.0 -Group: Development/Languages/Python +URL: http://github.com/openSUSE/py2pack Source: https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test/examples/py2pack-opensuse-legacy.spec new/py2pack-0.8.5/test/examples/py2pack-opensuse-legacy.spec --- old/py2pack-0.8.4/test/examples/py2pack-opensuse-legacy.spec 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test/examples/py2pack-opensuse-legacy.spec 2020-10-27 09:59:12.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-py2pack # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) __YEAR__ SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,18 +12,16 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ Name: python-py2pack Version: 0.8.0 Release: 0 -License: Apache-2.0 Summary: Generate distribution packages from PyPI -Url: http://github.com/openSUSE/py2pack -Group: Development/Languages/Python +License: Apache-2.0 +URL: http://github.com/openSUSE/py2pack Source: https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz -BuildRequires: python-devel BuildRequires: python-setuptools BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test/examples/py2pack-opensuse.spec new/py2pack-0.8.5/test/examples/py2pack-opensuse.spec --- old/py2pack-0.8.4/test/examples/py2pack-opensuse.spec 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test/examples/py2pack-opensuse.spec 2020-10-27 09:59:12.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-py2pack # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) __YEAR__ SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,24 +12,22 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-py2pack Version: 0.8.0 Release: 0 -License: Apache-2.0 Summary: Generate distribution packages from PyPI -Url: http://github.com/openSUSE/py2pack -Group: Development/Languages/Python +License: Apache-2.0 +URL: http://github.com/openSUSE/py2pack Source: https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz BuildRequires: python-rpm-macros -BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildArch: noarch - %python_subpackages %description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test/test_requires.py new/py2pack-0.8.5/test/test_requires.py --- old/py2pack-0.8.4/test/test_requires.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test/test_requires.py 2020-10-27 09:59:12.000000000 +0100 @@ -45,7 +45,7 @@ ("pywin32>=1.0;sys_platform=='win32' # PSF", False), ("foobar", True), ("foobar;python_version=='2.7'", sys.version_info[:2] == (2, 7)), - ("foobar;python_version=='3.5'", sys.version_info[:2] == (3, 5)), + ("foobar;python_version=='3.6'", sys.version_info[:2] == (3, 6)), ) @unpack def test__requirement_filter_by_marker(self, req, expected): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test/test_template.py new/py2pack-0.8.5/test/test_template.py --- old/py2pack-0.8.4/test/test_template.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test/test_template.py 2020-10-27 09:59:12.000000000 +0100 @@ -16,6 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import datetime import os import os.path import pwd @@ -48,6 +49,7 @@ with open(os.path.join(self.compare_dir, 'py2pack-%s' % template)) as filehandle: required = filehandle.read() required = required.replace('__USER__', self.username, 1) + required = required.replace('__YEAR__', str(datetime.date.today().year), 1) self.assertEqual(written_spec, required) return test_template diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test/test_utils.py new/py2pack-0.8.5/test/test_utils.py --- old/py2pack-0.8.4/test/test_utils.py 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test/test_utils.py 2020-10-27 09:59:12.000000000 +0100 @@ -64,3 +64,32 @@ expected_files = sorted(["file1", "file2", "file3"]) files = py2pack.utils._get_archive_filelist(file_name) self.assertEqual(expected_files, files) + + def test__get_archive_filelist_invalid_archive(self): + file_name = os.path.join(self.tmpdir, "file.txt") + # poor man's touch + with open(file_name, "w") as txt_file: + txt_file.write('') + + with self.assertRaises(ValueError) as val_err: + py2pack.utils._get_archive_filelist(file_name) + + self.assertIn(file_name, str(val_err.exception)) + self.assertIn("Not a tar or zip file", str(val_err.exception)) + + def test__get_archive_filelist_nonexistent_file(self): + file_name = os.path.join( + self.tmpdir, "this_does_not_exist.asdfqweruiae") + + # tarfile.is_tarfile() throws an IOError in Python2.7 and + # FileNotFoundError in Python3.6 + try: + expected_err = eval('FileNotFoundError') + except NameError: + expected_err = IOError + + with self.assertRaises(expected_err) as f_not_found_err: + py2pack.utils._get_archive_filelist(file_name) + + self.assertNotIn( + "Not a tar or zip file", str(f_not_found_err.exception)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/test-requirements.txt new/py2pack-0.8.5/test-requirements.txt --- old/py2pack-0.8.4/test-requirements.txt 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/test-requirements.txt 2020-10-27 09:59:12.000000000 +0100 @@ -1,6 +1,6 @@ coverage flake8 -nose +pytest ddt Sphinx>=1.2.1 sphinxcontrib.programoutput diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.4/tox.ini new/py2pack-0.8.5/tox.ini --- old/py2pack-0.8.4/tox.ini 2018-12-06 20:56:05.000000000 +0100 +++ new/py2pack-0.8.5/tox.ini 2020-10-27 09:59:12.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist = py27,py36,pep8,cover +envlist = py27,py36,py38,py39,pep8,cover [testenv] usedevelop = True @@ -8,11 +8,11 @@ -r{toxinidir}/test-requirements.txt install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} -commands = nosetests -v --with-xunit {posargs} +commands = pytest -v {posargs} [testenv:cover] commands = - coverage run --source=py2pack setup.py test + coverage run --source=py2pack -m pytest -v coverage report [testenv:docs]
