Hello community, here is the log from the commit of package python-py2pack for openSUSE:Factory checked in at 2020-11-10 15:08:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-py2pack (Old) and /work/SRC/openSUSE:Factory/.python-py2pack.new.11331 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-py2pack" Tue Nov 10 15:08:54 2020 rev:50 rq:847493 version:0.8.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-py2pack/python-py2pack.changes 2020-10-27 19:01:47.406867446 +0100 +++ /work/SRC/openSUSE:Factory/.python-py2pack.new.11331/python-py2pack.changes 2020-11-10 15:09:03.741476034 +0100 @@ -1,0 +2,16 @@ +Tue Nov 10 13:04:27 UTC 2020 - Thomas Bechtold <tbecht...@suse.com> + +- update to 0.8.6: + * Fix test/exampes/py2pack-opensuse.dsc + * enhance test\_template with augmented opensuse and update examples to 0.8.5 + * cleanup script basename filter + * update test reference + * Fix flake8 errors + * remove python2 from travis and tox + * change test suite block + * Replace python3\_only scripts with python\_alternatives + * migrate metadate fetch to JSON API + * remove python2 shims + * update copyright header + +------------------------------------------------------------------- Old: ---- py2pack-0.8.5.tar.gz New: ---- py2pack-0.8.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-py2pack.spec ++++++ --- /var/tmp/diff_new_pack.vleANu/_old 2020-11-10 15:09:04.321474834 +0100 +++ /var/tmp/diff_new_pack.vleANu/_new 2020-11-10 15:09:04.325474825 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-py2pack -Version: 0.8.5 +Version: 0.8.6 Release: 0 Summary: Script for generating distribution packages from Python packages on PyPI License: Apache-2.0 ++++++ py2pack-0.8.5.tar.gz -> py2pack-0.8.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/.travis.yml new/py2pack-0.8.6/.travis.yml --- old/py2pack-0.8.5/.travis.yml 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/.travis.yml 2020-11-10 10:44:47.000000000 +0100 @@ -8,8 +8,6 @@ env: TOX_ENV=py38 - python: 3.8 env: TOX_ENV=docs - - python: 2.7 - env: TOX_ENV=py27 - python: 3.6 env: TOX_ENV=py36 install: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/AUTHORS new/py2pack-0.8.6/AUTHORS --- old/py2pack-0.8.5/AUTHORS 2020-10-27 09:59:45.000000000 +0100 +++ new/py2pack-0.8.6/AUTHORS 2020-11-10 10:45:22.000000000 +0100 @@ -1,16 +1,14 @@ Adam Spiers <py2p...@adamspiers.org> Antonio Larrosa <larr...@kde.org> +Ben Greiner <c...@bnavigator.de> Christopher Yeleighton <ne01...@shark.2a.pl> Dan Čermák <dcer...@suse.com> Dirk Mueller <dmuel...@suse.com> Karol Babioch <kbabi...@suse.de> -Manuel Schnitzer <mschnit...@suse.de> Markéta Calábková <meggy.calabk...@gmail.com> Matěj Cepl <mc...@cepl.eu> MeggyCal <meggy...@users.noreply.github.com> Oliver Kurz <ok...@suse.de> -Sascha Peilicke <sas...@peilicke.de> -Sascha Peilicke <sasc...@mailbox.org> Sebastian Wagner <se...@sebix.at> Thomas Bechtold <tbecht...@suse.com> Tomáš Chvátal <tchva...@suse.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/ChangeLog new/py2pack-0.8.6/ChangeLog --- old/py2pack-0.8.5/ChangeLog 2020-10-27 09:59:45.000000000 +0100 +++ new/py2pack-0.8.6/ChangeLog 2020-11-10 10:45:22.000000000 +0100 @@ -1,6 +1,21 @@ CHANGES ======= +0.8.6 +----- + +* Fix test/exampes/py2pack-opensuse.dsc +* enhance test\_template with augmented opensuse and update examples to 0.8.5 +* cleanup script basename filter +* update test reference +* Fix flake8 errors +* remove python2 from travis and tox +* change test suite block +* Replace python3\_only scripts with python\_alternatives +* migrate metadate fetch to JSON API +* remove python2 shims +* update copyright header + 0.8.5 ----- @@ -160,9 +175,6 @@ * Remove py33 and py34 from travis and tox * travis: Fix python 3 test env variables * Don't list "./" in names for extracted zip/tar file -* Fix minimal version detection for requirements -* Support requirement markers -* Fix tests\_require handling * Adjust docs for testing * Remove whitespaces from README @@ -173,15 +185,3 @@ * Add myself as co-maintainer * Mention the "--run" as note in README * protect against failed eval of setup.py code fragments -* Also collect tests\_require metadata -* Remove distutils cleanup command -* Remove pypip.in images from README -* Relicense under Apache-2.0 -* Move setup.py sandbox run to extra file -* Also parse entry\_points when given as dict -* Fix company name in spec template - -0.5.0 ------ - -* Bump version to 0.5.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/PKG-INFO new/py2pack-0.8.6/PKG-INFO --- old/py2pack-0.8.5/PKG-INFO 2020-10-27 09:59:45.669325400 +0100 +++ new/py2pack-0.8.6/PKG-INFO 2020-11-10 10:45:22.593189200 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: py2pack -Version: 0.8.5 +Version: 0.8.6 Summary: Generate distribution packages from PyPI Home-page: http://github.com/openSUSE/py2pack Author: Sascha Peilicke, Thomas Bechtold @@ -150,7 +150,6 @@ Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX -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.5/py2pack/__init__.py new/py2pack-0.8.6/py2pack/__init__.py --- old/py2pack-0.8.5/py2pack/__init__.py 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/py2pack/__init__.py 2020-11-10 10:44:47.000000000 +0100 @@ -16,8 +16,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import - import argparse import datetime import glob @@ -27,14 +25,12 @@ import pprint import pwd import re +import requests import sys import urllib -from six.moves.urllib.request import urlretrieve -from six.moves import filter -from six.moves import xmlrpc_client import jinja2 import warnings -warnings.simplefilter('always', DeprecationWarning) +import xmlrpc from metaextract import utils as meta_utils @@ -43,13 +39,25 @@ import py2pack.utils from py2pack import version as py2pack_version +# https://warehouse.pypa.io/api-reference/xml-rpc.html +pypi_xml = xmlrpc.client.ServerProxy('https://pypi.org/pypi') -pypi = xmlrpc_client.ServerProxy('https://pypi.python.org/pypi') +warnings.simplefilter('always', DeprecationWarning) SPDX_LICENSES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spdx_license_map.p') SDPX_LICENSES = pickle.load(open(SPDX_LICENSES_FILE, 'rb')) +def pypi_json(project, release=None): + """Access the PyPI JSON API + + https://warehouse.pypa.io/api-reference/json.html + """ + version = ('/' + release) if release else '' + r = requests.get('https://pypi.org/pypi/{}{}/json'.format(project, version)) + return r.json() + + def _get_template_dirs(): """existing directories where to search for jinja2 templates. The order is important. The first found template from the first found dir wins!""" @@ -63,34 +71,33 @@ ]) -def list(args=None): +def list_packages(args=None): print('listing all PyPI packages...') - for package in pypi.list_packages(): + for package in pypi_xml.list_packages(): print(package) def search(args): print('searching for package {0}...'.format(args.name)) - for hit in pypi.search({'name': args.name}): + for hit in pypi_xml.search({'name': args.name}): print('found {0}-{1}'.format(hit['name'], hit['version'])) def show(args): - check_or_set_version(args) - print('showing package {0}...'.format(args.name)) - data = pypi.release_data(args.name, args.version) - pprint.pprint(data) + fetch_data(args) + print('showing package {0}...'.format(args.fetched_data['info']['name'])) + pprint.pprint(args.fetched_data) def fetch(args): - check_or_set_version(args) + fetch_data(args) url = newest_download_url(args) if not url: print("unable to find a source release for {0}!".format(args.name)) sys.exit(1) print('downloading package {0}-{1}...'.format(args.name, args.version)) print('from {0}'.format(url['url'])) - urlretrieve(url['url'], url['filename']) + urllib.request.urlretrieve(url['url'], url['filename']) def _canonicalize_setup_data(data): @@ -138,7 +145,7 @@ # convert to a dict and parse it data["entry_points"] = pkg_resources.EntryPoint.parse_map(data["entry_points"]) if "console_scripts" in data["entry_points"]: - data["console_scripts"] = data["entry_points"]["console_scripts"].keys() + data["console_scripts"] = list(data["entry_points"]["console_scripts"].keys()) def _quote_shell_metacharacters(string): @@ -222,34 +229,33 @@ warnings.warn("the '--run' switch is deprecated and a noop", DeprecationWarning) - check_or_set_version(args) + fetch_data(args) if not args.template: args.template = file_template_list()[0] if not args.filename: args.filename = args.name + '.' + args.template.rsplit('.', 1)[1] # take template file ending print('generating spec file for {0}...'.format(args.name)) - data = pypi.release_data(args.name, args.version) # fetch all meta data - url = newest_download_url(args) - if args.source_url: - data['source_url'] = args.source_url - elif url: - # do not use the url delivered by pypi. that url contains a hash and - # needs to be adjusted with every package update. Instead use - # the pypi.io url - data['source_url'] = _get_source_url(args.name, url['filename']) - else: - data['source_url'] = args.name + '-' + args.version + '.zip' + data = args.fetched_data['info'] + durl = newest_download_url(args) + data['source_url'] = (args.source_url or + (durl and durl['url']) or + 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(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 - # a - but the tarball name has a _ . Eg the package os-faults - tarball_file += glob.glob("{0}-{1}.*".format(args.name.replace('-', '_'), + # a '-' or '.' but the tarball name has a '_' . Eg the package os-faults + tr = str.maketrans('-.', '__') + tarball_file += glob.glob("{0}-{1}.*".format(args.name.translate(tr), args.version)) if tarball_file: # get some more info from that _augment_data_from_tarball(args, tarball_file[0], data) + else: + warnings.warn("No tarball for {} in version {} found. Valuable " + "information for the generation might be missing." + "".format(args.name, args.version)) _normalize_license(data) @@ -263,28 +269,35 @@ outfile.close() -def check_or_set_version(args): - if not args.version: # take first version found - releases = pypi.package_releases(args.name) - if len(releases) == 0: - print("unable to find a suitable release for {0}!".format(args.name)) - sys.exit(1) - else: - args.version = pypi.package_releases(args.name)[0] # return first (current) release number +def fetch_data(args): + args.fetched_data = pypi_json(args.name, args.version) + releases = args.fetched_data['releases'] + if len(releases) == 0: + print("unable to find a suitable release for {0}!".format(args.name)) + sys.exit(1) + else: + args.version = args.fetched_data['info']['version'] # return current release number def newest_download_url(args): - if args.source_url: - return {'url': args.source_url, - 'filename': args.source_url[args.source_url.rfind("/") + 1:]} - for url in pypi.release_urls(args.name, args.version): # Fetch all download URLs - if url['packagetype'] == 'sdist': # Found the source URL we care for - return url + """check but do not use the url delivered by pypi. that url contains a hash and + needs to be adjusted with every package update. Instead use + the pypi.io url + """ + if not hasattr(args, "fetched_data"): + return {} + for version, release_data in args.fetched_data['releases'].items(): # Check download URLs in releases + if (version == args.version): + for release in release_data: + if release['packagetype'] == 'sdist': # Found the source URL we care for + release['url'] = _get_source_url(args.name, release['filename']) + return release # No PyPI tarball release, let's see if an upstream download URL is provided: - data = pypi.release_data(args.name, args.version) # Fetch all meta data + data = args.fetched_data['info'] if 'download_url' in data and data['download_url']: - filename = os.path.basename(data['download_url']) - return {'url': data['download_url'], 'filename': filename} + url = data['download_url'] + return {'url': url, + 'filename': os.path.basename(url)} return {} # We're all out of bubblegum @@ -302,7 +315,7 @@ subparsers = parser.add_subparsers(title='commands') parser_list = subparsers.add_parser('list', help='list all packages on PyPI') - parser_list.set_defaults(func=list) + parser_list.set_defaults(func=list_packages) parser_search = subparsers.add_parser('search', help='search for packages on PyPI') parser_search.add_argument('name', help='package name (with optional version)') @@ -345,7 +358,7 @@ sys.exit(1) transport = py2pack.proxy.ProxiedTransport() transport.set_proxy(args.proxy) - pypi._ServerProxy__transport = transport # Evil, but should do the trick + pypi_xml._ServerProxy__transport = transport # Evil, but should do the trick if 'func' not in args: sys.exit(parser.print_help()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/py2pack/requires.py new/py2pack-0.8.6/py2pack/requires.py --- old/py2pack-0.8.5/py2pack/requires.py 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/py2pack/requires.py 2020-11-10 10:44:47.000000000 +0100 @@ -25,13 +25,10 @@ <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 map def _requirement_filter_by_marker(req): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/py2pack/templates/opensuse.spec new/py2pack-0.8.6/py2pack/templates/opensuse.spec --- old/py2pack-0.8.5/py2pack/templates/opensuse.spec 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/py2pack/templates/opensuse.spec 2020-11-10 10:44:47.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-{{ name }} # -# Copyright (c) {{ year }} SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) {{ year }} SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -73,11 +73,19 @@ %setup -q -n {{ name }}-%{version} %build -{% if has_ext_modules %}export CFLAGS="%{optflags}" -{% endif %}%python_build +{%- if has_ext_modules %} +export CFLAGS="%{optflags}" +{%- endif %} +%python_build %install %python_install +{%- set scripts_or_console_scripts = ( + (scripts|map('basename') if scripts and scripts is not none else []) + + (console_scripts if console_scripts and console_scripts is not none else [])) %} +{%- for script in scripts_or_console_scripts %} +%python_clone -a %{buildroot}%{_bindir}/{{ script }} +{%- endfor %} {%- if has_ext_modules %} %python_expand %fdupes %{buildroot}%{$python_sitearch} {%- else %} @@ -85,8 +93,22 @@ {%- endif %} {%- if testsuite or test_suite %} + %check -%python_exec setup.py test +{%- if has_ext_modules %} +CHOOSE: %pytest_arch OR %pyunittest_arch -v OR CUSTOM +{%- else %} +CHOOSE: %pytest OR %pyunittest -v OR CUSTOM +{%- endif %} +{%- endif %} + +{%- if scripts_or_console_scripts %} + +%post +%python_install_alternative {{ scripts_or_console_scripts|join(" ") }} + +%postun +%python_uninstall_alternative {{ scripts_or_console_scripts|first }} {%- endif %} %files %{python_files} @@ -96,16 +118,9 @@ {%- if license_files and license_files is not none %} %license {{ license_files|join(" ") }} {%- endif %} -{%- if scripts and scripts is not none %} -{%- for script in scripts %} -%python3_only %{_bindir}/{{ script|basename }} +{%- for script in scripts_or_console_scripts %} +%python_alternative %{_bindir}/{{ script }} {%- endfor %} -{%- endif %} -{%- if console_scripts and console_scripts is not none %} -{%- for script in console_scripts %} -%python3_only %{_bindir}/{{ script }} -{%- endfor %} -{%- endif %} {%- if has_ext_modules %} %{python_sitearch}/* {%- else %} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/py2pack.egg-info/PKG-INFO new/py2pack-0.8.6/py2pack.egg-info/PKG-INFO --- old/py2pack-0.8.5/py2pack.egg-info/PKG-INFO 2020-10-27 09:59:45.000000000 +0100 +++ new/py2pack-0.8.6/py2pack.egg-info/PKG-INFO 2020-11-10 10:45:22.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: py2pack -Version: 0.8.5 +Version: 0.8.6 Summary: Generate distribution packages from PyPI Home-page: http://github.com/openSUSE/py2pack Author: Sascha Peilicke, Thomas Bechtold @@ -150,7 +150,6 @@ Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX -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.5/py2pack.egg-info/SOURCES.txt new/py2pack-0.8.6/py2pack.egg-info/SOURCES.txt --- old/py2pack-0.8.5/py2pack.egg-info/SOURCES.txt 2020-10-27 09:59:45.000000000 +0100 +++ new/py2pack-0.8.6/py2pack.egg-info/SOURCES.txt 2020-11-10 10:45:22.000000000 +0100 @@ -40,6 +40,7 @@ test/test_utils.py test/examples/py2pack-fedora.spec test/examples/py2pack-mageia.spec +test/examples/py2pack-opensuse-augmented.spec test/examples/py2pack-opensuse-legacy.spec test/examples/py2pack-opensuse.dsc test/examples/py2pack-opensuse.spec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/py2pack.egg-info/pbr.json new/py2pack-0.8.6/py2pack.egg-info/pbr.json --- old/py2pack-0.8.5/py2pack.egg-info/pbr.json 2020-10-27 09:59:45.000000000 +0100 +++ new/py2pack-0.8.6/py2pack.egg-info/pbr.json 2020-11-10 10:45:22.000000000 +0100 @@ -1 +1 @@ -{"git_version": "d9adb54", "is_release": true} \ No newline at end of file +{"git_version": "a1d6ac8", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/py2pack.egg-info/requires.txt new/py2pack-0.8.6/py2pack.egg-info/requires.txt --- old/py2pack-0.8.5/py2pack.egg-info/requires.txt 2020-10-27 09:59:45.000000000 +0100 +++ new/py2pack-0.8.6/py2pack.egg-info/requires.txt 2020-11-10 10:45:22.000000000 +0100 @@ -1,7 +1,7 @@ Jinja2 setuptools -six metaextract +requests [:(python_version<'3.5')] typing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/requirements.txt new/py2pack-0.8.6/requirements.txt --- old/py2pack-0.8.5/requirements.txt 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/requirements.txt 2020-11-10 10:44:47.000000000 +0100 @@ -1,5 +1,5 @@ Jinja2 setuptools -six metaextract +requests typing;python_version<'3.5' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/setup.cfg new/py2pack-0.8.6/setup.cfg --- old/py2pack-0.8.5/setup.cfg 2020-10-27 09:59:45.673327200 +0100 +++ new/py2pack-0.8.6/setup.cfg 2020-11-10 10:45:22.593189200 +0100 @@ -14,7 +14,6 @@ Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX - 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.5/test/examples/py2pack-fedora.spec new/py2pack-0.8.6/test/examples/py2pack-fedora.spec --- old/py2pack-0.8.5/test/examples/py2pack-fedora.spec 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/examples/py2pack-fedora.spec 2020-11-10 10:44:47.000000000 +0100 @@ -5,7 +5,7 @@ # Name: python-py2pack -Version: 0.8.0 +Version: 0.8.5 Release: 0 Summary: Generate distribution packages from PyPI License: Apache-2.0 @@ -125,11 +125,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. @@ -144,10 +144,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 %prep diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/examples/py2pack-mageia.spec new/py2pack-0.8.6/test/examples/py2pack-mageia.spec --- old/py2pack-0.8.5/test/examples/py2pack-mageia.spec 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/examples/py2pack-mageia.spec 2020-11-10 10:44:47.000000000 +0100 @@ -1,7 +1,7 @@ %define mod_name py2pack Name: python-%{mod_name} -Version: 0.8.0 +Version: 0.8.5 Release: %mkrel 1 Url: http://github.com/openSUSE/py2pack Summary: Generate distribution packages from PyPI diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/examples/py2pack-opensuse-augmented.spec new/py2pack-0.8.6/test/examples/py2pack-opensuse-augmented.spec --- old/py2pack-0.8.5/test/examples/py2pack-opensuse-augmented.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.6/test/examples/py2pack-opensuse-augmented.spec 2020-11-10 10:44:47.000000000 +0100 @@ -0,0 +1,80 @@ +# +# spec file for package python-py2pack +# +# Copyright (c) __YEAR__ SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-py2pack +Version: 0.8.5 +Release: 0 +Summary: Generate distribution packages from PyPI +License: UNKNOWN (FIXME:No SPDX) +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 setuptools} +BuildRequires: %{python_module pbr >= 1.8} +# SECTION test requirements +BuildRequires: %{python_module Jinja2} +BuildRequires: %{python_module metaextract} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module six} +BuildRequires: %{python_module coverage} +BuildRequires: %{python_module ddt} +BuildRequires: %{python_module flake8} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module Sphinx >= 1.2.1} +BuildRequires: %{python_module sphinxcontrib.programoutput} +# /SECTION +BuildRequires: fdupes +Requires: python-Jinja2 +Requires: python-metaextract +Requires: python-setuptools +Requires: python-six +Suggests: python-typing +BuildArch: noarch +%python_subpackages + +%description +Generate distribution packages from PyPI + +%prep +%setup -q -n py2pack-%{version} + +%build +%python_build + +%install +%python_install +%python_clone -a %{buildroot}%{_bindir}/py2pack +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +CHOOSE: %pytest OR %pyunittest -v OR CUSTOM + +%post +%python_install_alternative py2pack + +%postun +%python_uninstall_alternative py2pack + +%files %{python_files} +%doc AUTHORS ChangeLog README.rst +%license LICENSE +%python_alternative %{_bindir}/py2pack +%{python_sitelib}/* + +%changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/examples/py2pack-opensuse-legacy.spec new/py2pack-0.8.6/test/examples/py2pack-opensuse-legacy.spec --- old/py2pack-0.8.5/test/examples/py2pack-opensuse-legacy.spec 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/examples/py2pack-opensuse-legacy.spec 2020-11-10 10:44:47.000000000 +0100 @@ -16,7 +16,7 @@ Name: python-py2pack -Version: 0.8.0 +Version: 0.8.5 Release: 0 Summary: Generate distribution packages from PyPI License: Apache-2.0 @@ -137,11 +137,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. @@ -156,10 +156,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 %prep diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/examples/py2pack-opensuse.dsc new/py2pack-0.8.6/test/examples/py2pack-opensuse.dsc --- old/py2pack-0.8.5/test/examples/py2pack-opensuse.dsc 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/examples/py2pack-opensuse.dsc 2020-11-10 10:44:47.000000000 +0100 @@ -1,6 +1,6 @@ Format: 1.0 Source: py2pack -Version: 0.8.0 +Version: 0.8.5 Binary: python-py2pack Maintainer: __USER__ Architecture: any diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/examples/py2pack-opensuse.spec new/py2pack-0.8.6/test/examples/py2pack-opensuse.spec --- old/py2pack-0.8.5/test/examples/py2pack-opensuse.spec 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/examples/py2pack-opensuse.spec 2020-11-10 10:44:47.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-py2pack # -# Copyright (c) __YEAR__ SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) __YEAR__ 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.0 +Version: 0.8.5 Release: 0 Summary: Generate distribution packages from PyPI License: Apache-2.0 @@ -141,11 +141,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. @@ -160,10 +160,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 %prep diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/test_py2pack.py new/py2pack-0.8.6/test/test_py2pack.py --- old/py2pack-0.8.5/test/test_py2pack.py 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/test_py2pack.py 2020-11-10 10:44:47.000000000 +0100 @@ -47,7 +47,7 @@ expected_url) def test_list(self): - py2pack.list(self.args) + py2pack.list_packages(self.args) def test_search(self): py2pack.search(self.args) @@ -56,6 +56,7 @@ py2pack.show(self.args) def test_newest_download_url(self): + py2pack.fetch_data(self.args) url = py2pack.newest_download_url(self.args) self.assertTrue("url" in url) self.assertTrue("filename" in url) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/test/test_template.py new/py2pack-0.8.6/test/test_template.py --- old/py2pack-0.8.5/test/test_template.py 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/test/test_template.py 2020-11-10 10:44:47.000000000 +0100 @@ -20,8 +20,8 @@ import os import os.path import pwd -import tempfile -import unittest + +import pytest import py2pack @@ -31,36 +31,42 @@ template = '' filename = '' name = 'py2pack' - version = '0.8.0' + version = '0.8.5' source_url = None -def generate_template_function(template): - def test_template(self): - """ Test if generated specfile for %s equals to stored one. """ % template - args = Args() - args.template = template - with tempfile.NamedTemporaryFile(mode='w+t') as filehandle: - filename = filehandle.name - args.filename = filename +compare_dir = os.path.join(os.path.dirname(__file__), 'examples') +maxDiff = None +username = pwd.getpwuid(os.getuid())[4] + + +@pytest.mark.parametrize('template, fetch_tarball', + [('fedora.spec', False), + ('mageia.spec', False), + ('opensuse-legacy.spec', False), + ('opensuse.dsc', False), + ('opensuse.spec', False), + ('opensuse.spec', True)]) +def test_template(tmpdir, template, fetch_tarball): + """ Test if generated specfile equals to stored one. """ + args = Args() + args.template = template + base, ext = template.split(".") + suffix = '-augmented' if fetch_tarball else '' + filename = "{}{}.{}".format(base, suffix, ext) + args.filename = filename + with tmpdir.as_cwd(): + if fetch_tarball: + py2pack.fetch(args) py2pack.generate(args) - filehandle.seek(0) + else: + with pytest.warns(UserWarning, match="No tarball"): + py2pack.generate(args) + with open(filename) as filehandle: written_spec = filehandle.read() - 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 - - -class TemplateTestCase(unittest.TestCase): - compare_dir = os.path.join(os.path.dirname(__file__), 'examples') - maxDiff = None - username = pwd.getpwuid(os.getuid())[4] - - -for template in ('fedora.spec', 'mageia.spec', 'opensuse-legacy.spec', 'opensuse.dsc', 'opensuse.spec'): - setattr(TemplateTestCase, - 'test_template_%s' % template, - generate_template_function(template)) + reference = os.path.join(compare_dir, 'py2pack-{}'.format(filename)) + with open(reference) as filehandle: + required = filehandle.read() + required = required.replace('__USER__', username, 1) + required = required.replace('__YEAR__', str(datetime.date.today().year), 1) + assert written_spec == required diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.5/tox.ini new/py2pack-0.8.6/tox.ini --- old/py2pack-0.8.5/tox.ini 2020-10-27 09:59:12.000000000 +0100 +++ new/py2pack-0.8.6/tox.ini 2020-11-10 10:44:47.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist = py27,py36,py38,py39,pep8,cover +envlist = py36,py38,py39,pep8,cover [testenv] usedevelop = True