Hello community, here is the log from the commit of package python-py2pack for openSUSE:Factory checked in at 2017-12-23 12:20:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-py2pack (Old) and /work/SRC/openSUSE:Factory/.python-py2pack.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-py2pack" Sat Dec 23 12:20:11 2017 rev:43 rq:559276 version:0.8.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-py2pack/python-py2pack.changes 2017-08-12 20:27:34.376913648 +0200 +++ /work/SRC/openSUSE:Factory/.python-py2pack.new/python-py2pack.changes 2017-12-23 12:20:15.149342029 +0100 @@ -1,0 +2,11 @@ +Fri Dec 22 09:48:29 UTC 2017 - [email protected] + +- update to 0.8.2: + * pep8 fixes + * opensuse template updates + * Add source\_url to Args in tests and use None as default value + * Removed unneeded nargs parameter to add\_argument + * Add a --source-url parameter to 'fetch' and 'generate' commands + * tests: templates: fix version + +------------------------------------------------------------------- Old: ---- py2pack-0.8.1.tar.gz New: ---- py2pack-0.8.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-py2pack.spec ++++++ --- /var/tmp/diff_new_pack.kDGU7R/_old 2017-12-23 12:20:16.389281570 +0100 +++ /var/tmp/diff_new_pack.kDGU7R/_new 2017-12-23 12:20:16.393281375 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-py2pack -Version: 0.8.1 +Version: 0.8.2 Release: 0 Url: http://github.com/saschpe/py2pack Summary: Generate distribution packages from Python packages on PyPI ++++++ py2pack-0.8.1.tar.gz -> py2pack-0.8.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/AUTHORS new/py2pack-0.8.2/AUTHORS --- old/py2pack-0.8.1/AUTHORS 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/AUTHORS 2017-12-22 10:46:28.000000000 +0100 @@ -1,4 +1,5 @@ Adam Spiers <[email protected]> +Antonio Larrosa <[email protected]> Jürgen Weigert <[email protected]> Lukas Wunner <[email protected]> Manuel Schnitzer <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/ChangeLog new/py2pack-0.8.2/ChangeLog --- old/py2pack-0.8.1/ChangeLog 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/ChangeLog 2017-12-22 10:46:28.000000000 +0100 @@ -1,9 +1,20 @@ CHANGES ======= +0.8.2 +----- + +* pep8 fixes +* opensuse template updates +* Add source\_url to Args in tests and use None as default value +* Removed unneeded nargs parameter to add\_argument +* Add a --source-url parameter to 'fetch' and 'generate' commands +* tests: templates: fix version + 0.8.1 ----- +* Test templates with saved output * Enable tests with python setup.py test * Also support for python 3.6 * Fix opensuse's multipython template @@ -171,7 +182,3 @@ ----- * Release version 0.4.9 -* Fix coverage report source -* Add py26 trove classifier -* Add cssselect setup\_requires -* Rename SPDX license map diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/PKG-INFO new/py2pack-0.8.2/PKG-INFO --- old/py2pack-0.8.1/PKG-INFO 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/PKG-INFO 2017-12-22 10:46:28.000000000 +0100 @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: py2pack -Version: 0.8.1 +Version: 0.8.2 Summary: Generate distribution packages from PyPI Home-page: http://github.com/openSUSE/py2pack Author: Sascha Peilicke, Thomas Bechtold Author-email: [email protected], [email protected] License: UNKNOWN +Description-Content-Type: UNKNOWN Description: Py2pack: Generate distribution packages from PyPI ================================================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack/__init__.py new/py2pack-0.8.2/py2pack/__init__.py --- old/py2pack-0.8.1/py2pack/__init__.py 2017-08-11 10:15:02.000000000 +0200 +++ new/py2pack-0.8.2/py2pack/__init__.py 2017-12-22 10:45:48.000000000 +0100 @@ -177,15 +177,15 @@ def _normalize_license(data): """try to get SDPX license""" - l = data.get('license', None) - if not l: + license = data.get('license', None) + if not license: # try to get license from classifiers - l = _license_from_classifiers(data) - if l: - if l in SDPX_LICENSES.keys(): - data['license'] = SDPX_LICENSES[l] + license = _license_from_classifiers(data) + if license: + if license in SDPX_LICENSES.keys(): + data['license'] = SDPX_LICENSES[license] else: - data['license'] = "%s (FIXME:No SPDX)" % (l) + data['license'] = "%s (FIXME:No SPDX)" % (license) else: data['license'] = "" @@ -221,7 +221,9 @@ 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 url: + 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 @@ -263,6 +265,9 @@ 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.package_urls(args.name, args.version): # Fetch all download URLs if url['packagetype'] == 'sdist': # Found the source URL we care for return url @@ -302,11 +307,13 @@ parser_fetch = subparsers.add_parser('fetch', help='download package source tarball from PyPI') parser_fetch.add_argument('name', help='package name') parser_fetch.add_argument('version', nargs='?', help='package version (optional)') + parser_fetch.add_argument('--source-url', default=None, help='source url') parser_fetch.set_defaults(func=fetch) parser_generate = subparsers.add_parser('generate', help='generate RPM spec or DEB dsc file for a package') parser_generate.add_argument('name', help='package name') parser_generate.add_argument('version', nargs='?', help='package version (optional)') + parser_generate.add_argument('--source-url', default=None, help='source url') parser_generate.add_argument('-t', '--template', choices=file_template_list(), default='opensuse.spec', help='file template') parser_generate.add_argument('-f', '--filename', help='spec filename (optional)') # TODO (toabctl): remove this is a later release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack/proxy.py new/py2pack-0.8.2/py2pack/proxy.py --- old/py2pack-0.8.1/py2pack/proxy.py 2017-08-11 10:15:02.000000000 +0200 +++ new/py2pack-0.8.2/py2pack/proxy.py 2017-12-22 10:45:48.000000000 +0100 @@ -17,11 +17,11 @@ try: import http.client as httplib -except: +except ImportError: import httplib try: import xmlrpc.client as xmlrpclib -except: +except ImportError: import xmlrpclib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack/setup.py new/py2pack-0.8.2/py2pack/setup.py --- old/py2pack-0.8.1/py2pack/setup.py 2017-08-11 10:15:02.000000000 +0200 +++ new/py2pack-0.8.2/py2pack/setup.py 2017-12-22 10:45:48.000000000 +0100 @@ -31,7 +31,7 @@ try: subprocess.call(["xsltproc", "--output", "doc/py2pack.html", "/usr/share/xml/docbook/stylesheet/nwalsh/current/html/docbook.xsl", "doc/src/py2pack.xml.in"]) subprocess.call(["xsltproc", "--output", "doc/py2pack.1", "/usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl", "doc/src/py2pack.xml.in"]) - except: + except OSError: pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack/templates/opensuse.spec new/py2pack-0.8.2/py2pack/templates/opensuse.spec --- old/py2pack-0.8.1/py2pack/templates/opensuse.spec 2017-08-11 10:15:02.000000000 +0200 +++ new/py2pack-0.8.2/py2pack/templates/opensuse.spec 2017-12-22 10:45:48.000000000 +0100 @@ -16,7 +16,6 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without test Name: python-{{ name }} Version: {{ version }} Release: 0 @@ -33,20 +32,18 @@ BuildRequires: %{python_module {{ req }}} {%- endfor %} {%- endif %} +{%- if (install_requires and install_requires is not none) or (tests_require and tests_require is not none) %} +# SECTION test requirements {%- if install_requires and install_requires is not none %} -%if %{with test} {%- for req in install_requires|sort %} BuildRequires: %{python_module {{ req }}} {%- endfor %} -%endif {%- endif %} {%- if tests_require and tests_require is not none %} -# SECTION test requirements -%if %{with test} {%- for req in tests_require|sort %} BuildRequires: %{python_module {{ req }}} {%- endfor %} -%endif +{%- endif %} # /SECTION {%- endif %} {%- if source_url.endswith('.zip') %} @@ -90,14 +87,11 @@ {%- endif %} {%- if testsuite or test_suite %} -%if %{with test} %check %python_exec setup.py test -%endif {%- endif %} %files %{python_files} -%defattr(-,root,root,-) {%- if doc_files and doc_files is not none %} %doc {{ doc_files|join(" ") }} {%- endif %} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack/version.py new/py2pack-0.8.2/py2pack/version.py --- old/py2pack-0.8.1/py2pack/version.py 2017-08-11 10:15:02.000000000 +0200 +++ new/py2pack-0.8.2/py2pack/version.py 2017-12-22 10:45:48.000000000 +0100 @@ -17,7 +17,7 @@ try: from pbr import version as pbr_version -except: +except ImportError: # no pbr available version = 'unknown' pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack.egg-info/PKG-INFO new/py2pack-0.8.2/py2pack.egg-info/PKG-INFO --- old/py2pack-0.8.1/py2pack.egg-info/PKG-INFO 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/py2pack.egg-info/PKG-INFO 2017-12-22 10:46:28.000000000 +0100 @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: py2pack -Version: 0.8.1 +Version: 0.8.2 Summary: Generate distribution packages from PyPI Home-page: http://github.com/openSUSE/py2pack Author: Sascha Peilicke, Thomas Bechtold Author-email: [email protected], [email protected] License: UNKNOWN +Description-Content-Type: UNKNOWN Description: Py2pack: Generate distribution packages from PyPI ================================================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack.egg-info/SOURCES.txt new/py2pack-0.8.2/py2pack.egg-info/SOURCES.txt --- old/py2pack-0.8.1/py2pack.egg-info/SOURCES.txt 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/py2pack.egg-info/SOURCES.txt 2017-12-22 10:46:28.000000000 +0100 @@ -36,5 +36,11 @@ test/__init__.py test/test_py2pack.py test/test_requires.py +test/test_template.py test/test_utils.py +test/examples/py2pack-fedora.spec +test/examples/py2pack-mageia.spec +test/examples/py2pack-opensuse-legacy.spec +test/examples/py2pack-opensuse.dsc +test/examples/py2pack-opensuse.spec tools/obs-from-pypi.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/py2pack.egg-info/pbr.json new/py2pack-0.8.2/py2pack.egg-info/pbr.json --- old/py2pack-0.8.1/py2pack.egg-info/pbr.json 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/py2pack.egg-info/pbr.json 2017-12-22 10:46:28.000000000 +0100 @@ -1 +1 @@ -{"git_version": "8592a88", "is_release": true} \ No newline at end of file +{"git_version": "8ae6f47", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/setup.cfg new/py2pack-0.8.2/setup.cfg --- old/py2pack-0.8.1/setup.cfg 2017-08-11 10:15:34.000000000 +0200 +++ new/py2pack-0.8.2/setup.cfg 2017-12-22 10:46:28.000000000 +0100 @@ -53,5 +53,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/examples/py2pack-fedora.spec new/py2pack-0.8.2/test/examples/py2pack-fedora.spec --- old/py2pack-0.8.1/test/examples/py2pack-fedora.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.2/test/examples/py2pack-fedora.spec 2017-12-22 10:45:48.000000000 +0100 @@ -0,0 +1,170 @@ +# +# spec file for package python-py2pack +# +# Copyright (c) 2017 __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 +Source: https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: python-devel + +%description +Py2pack: Generate distribution packages from PyPI +================================================= + +.. image:: https://travis-ci.org/openSUSE/py2pack.png?branch=master + :target: https://travis-ci.org/openSUSE/py2pack + + +This script allows to generate RPM spec or DEB dsc files from Python modules. +It allows to list Python modules or search for them on the Python Package Index +(PyPI). Conveniently, it can fetch tarballs and changelogs making it an +universal tool to package Python modules. + + +Installation +------------ + +To install py2pack from the `Python Package Index`_, simply: + +.. code-block:: bash + + $ pip install py2pack + +Or, if you absolutely must: + +.. code-block:: bash + + $ easy_install py2pack + +But, you really shouldn't do that. Lastly, you can check your distro of choice +if they provide packages. For openSUSE, you can find packages in the `Open +Build Service`_ for all releases. If you happen to use openSUSE:Factory (the +rolling release / development version), simply: + +.. code-block:: bash + + $ sudo zypper install python-py2pack + + +Usage +----- + +Lets suppose you want to package zope.interface_ and you don't know how it is named +exactly. First of all, you can search for it and download the source tarball if +you found the correct module: + +.. code-block:: bash + + $ py2pack search zope.interface + searching for module zope.interface... + found zope.interface-3.6.1 + $ py2pack fetch zope.interface + downloading package zope.interface-3.6.1... + from http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.6.1.tar.gz + + +As a next step you may want to generate a package recipe for your distribution. +For RPM_-based distributions (let's use openSUSE_ as an example), you want to +generate a spec file (named 'python-zope.interface.spec'): + +.. code-block:: bash + + $ py2pack generate zope.interface -t opensuse.spec -f python-zope.interface.spec + +The source tarball and the package recipe is all you need to generate the RPM_ +(or DEB_) file. +This final step may depend on which distribution you use. Again, +for openSUSE_ (and by using the `Open Build Service`_), the complete recipe is: + +.. code-block:: bash + + $ osc mkpac python-zope.interface + $ cd python-zope.interface + $ py2pack fetch zope.interface + $ py2pack generate zope.interface -f python-zope.interface.spec + $ osc build + ... + +Depending on the module, you may have to adapt the resulting spec file slightly. +To get further help about py2pack usage, issue the following command: + +.. code-block:: bash + + $ py2pack help + + +Hacking and contributing +------------------------ + +You can test py2pack from your git checkout by executing the py2pack module: + +.. code-block:: bash + + $ python -m py2pack + +Fork `the repository`_ on Github to start making your changes to the **master** +branch (or branch off of it). Don't forget to write a test for fixed issues or +implemented features whenever appropriate. You can invoke the testsuite from +the repository root directory via `tox`_: + +.. code-block:: bash + + $ tox + +To run a single test class via `tox`_, use i.e.: + +.. code-block:: bash + + $ tox -epy27 test.test_py2pack:Py2packTestCase + + +You can also run `nose`_ directly: + +.. code-block:: bash + + $ nosetests + +It assumes you have the test dependencies installed (available on PYTHONPATH) +on your system. + +:copyright: (c) 2013 Sascha Peilicke. +:license: Apache-2.0, see LICENSE for more details. + + +.. _argparse: http://pypi.python.org/pypi/argparse +.. _Jinja2: http://pypi.python.org/pypi/Jinja2 +.. _zope.interface: http://pypi.python.org/pypi/zope.interface/ +.. _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 +.. _`the repository`: https://github.com/openSUSE/py2pack +.. _`nose`: https://nose.readthedocs.org +.. _`tox`: http://testrun.org/tox + +%prep +%setup -q -n py2pack-%{version} + +%build +python setup.py build + +%install +python setup.py install --prefix=%{_prefix} --root=%{buildroot} + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{python_sitelib}/* + +%changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/examples/py2pack-mageia.spec new/py2pack-0.8.2/test/examples/py2pack-mageia.spec --- old/py2pack-0.8.1/test/examples/py2pack-mageia.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.2/test/examples/py2pack-mageia.spec 2017-12-22 10:45:48.000000000 +0100 @@ -0,0 +1,32 @@ +%define mod_name py2pack + +Name: python-%{mod_name} +Version: 0.8.0 +Release: %mkrel 1 +Url: http://github.com/openSUSE/py2pack +Summary: Generate distribution packages from PyPI +License: Apache-2.0 +Group: Development/Python +Source: https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot +BuildRequires: python-devel + +%description +Generate distribution packages from PyPI + + +%prep +%setup -q -n %{mod_name}-%{version} + +%build +%{__python} setup.py build + +%install +%{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot} + +%clean +rm -rf %{buildroot} + +%files -f +%defattr(-,root,root) +%{python_sitelib}/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/examples/py2pack-opensuse-legacy.spec new/py2pack-0.8.2/test/examples/py2pack-opensuse-legacy.spec --- old/py2pack-0.8.1/test/examples/py2pack-opensuse-legacy.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.2/test/examples/py2pack-opensuse-legacy.spec 2017-12-22 10:45:48.000000000 +0100 @@ -0,0 +1,180 @@ +# +# spec file for package python-py2pack +# +# Copyright (c) 2017 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 +# 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 http://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 +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 + +%description +Py2pack: Generate distribution packages from PyPI +================================================= + +.. image:: https://travis-ci.org/openSUSE/py2pack.png?branch=master + :target: https://travis-ci.org/openSUSE/py2pack + + +This script allows to generate RPM spec or DEB dsc files from Python modules. +It allows to list Python modules or search for them on the Python Package Index +(PyPI). Conveniently, it can fetch tarballs and changelogs making it an +universal tool to package Python modules. + + +Installation +------------ + +To install py2pack from the `Python Package Index`_, simply: + +.. code-block:: bash + + $ pip install py2pack + +Or, if you absolutely must: + +.. code-block:: bash + + $ easy_install py2pack + +But, you really shouldn't do that. Lastly, you can check your distro of choice +if they provide packages. For openSUSE, you can find packages in the `Open +Build Service`_ for all releases. If you happen to use openSUSE:Factory (the +rolling release / development version), simply: + +.. code-block:: bash + + $ sudo zypper install python-py2pack + + +Usage +----- + +Lets suppose you want to package zope.interface_ and you don't know how it is named +exactly. First of all, you can search for it and download the source tarball if +you found the correct module: + +.. code-block:: bash + + $ py2pack search zope.interface + searching for module zope.interface... + found zope.interface-3.6.1 + $ py2pack fetch zope.interface + downloading package zope.interface-3.6.1... + from http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.6.1.tar.gz + + +As a next step you may want to generate a package recipe for your distribution. +For RPM_-based distributions (let's use openSUSE_ as an example), you want to +generate a spec file (named 'python-zope.interface.spec'): + +.. code-block:: bash + + $ py2pack generate zope.interface -t opensuse.spec -f python-zope.interface.spec + +The source tarball and the package recipe is all you need to generate the RPM_ +(or DEB_) file. +This final step may depend on which distribution you use. Again, +for openSUSE_ (and by using the `Open Build Service`_), the complete recipe is: + +.. code-block:: bash + + $ osc mkpac python-zope.interface + $ cd python-zope.interface + $ py2pack fetch zope.interface + $ py2pack generate zope.interface -f python-zope.interface.spec + $ osc build + ... + +Depending on the module, you may have to adapt the resulting spec file slightly. +To get further help about py2pack usage, issue the following command: + +.. code-block:: bash + + $ py2pack help + + +Hacking and contributing +------------------------ + +You can test py2pack from your git checkout by executing the py2pack module: + +.. code-block:: bash + + $ python -m py2pack + +Fork `the repository`_ on Github to start making your changes to the **master** +branch (or branch off of it). Don't forget to write a test for fixed issues or +implemented features whenever appropriate. You can invoke the testsuite from +the repository root directory via `tox`_: + +.. code-block:: bash + + $ tox + +To run a single test class via `tox`_, use i.e.: + +.. code-block:: bash + + $ tox -epy27 test.test_py2pack:Py2packTestCase + + +You can also run `nose`_ directly: + +.. code-block:: bash + + $ nosetests + +It assumes you have the test dependencies installed (available on PYTHONPATH) +on your system. + +:copyright: (c) 2013 Sascha Peilicke. +:license: Apache-2.0, see LICENSE for more details. + + +.. _argparse: http://pypi.python.org/pypi/argparse +.. _Jinja2: http://pypi.python.org/pypi/Jinja2 +.. _zope.interface: http://pypi.python.org/pypi/zope.interface/ +.. _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 +.. _`the repository`: https://github.com/openSUSE/py2pack +.. _`nose`: https://nose.readthedocs.org +.. _`tox`: http://testrun.org/tox + +%prep +%setup -q -n py2pack-%{version} + +%build +python setup.py build + +%install +python setup.py install --prefix=%{_prefix} --root=%{buildroot} + +%files +%defattr(-,root,root,-) +%{python_sitelib}/* + +%changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/examples/py2pack-opensuse.dsc new/py2pack-0.8.2/test/examples/py2pack-opensuse.dsc --- old/py2pack-0.8.1/test/examples/py2pack-opensuse.dsc 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.2/test/examples/py2pack-opensuse.dsc 2017-12-22 10:45:48.000000000 +0100 @@ -0,0 +1,8 @@ +Format: 1.0 +Source: py2pack +Version: 0.8.0 +Binary: python-py2pack +Maintainer: __USER__ +Architecture: any +Standards-Version: 3.7.1 +Build-Depends: debhelper (>= 4.0.0), python-dev diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/examples/py2pack-opensuse.spec new/py2pack-0.8.2/test/examples/py2pack-opensuse.spec --- old/py2pack-0.8.1/test/examples/py2pack-opensuse.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.2/test/examples/py2pack-opensuse.spec 2017-12-22 10:45:48.000000000 +0100 @@ -0,0 +1,184 @@ +# +# spec file for package python-py2pack +# +# Copyright (c) 2017 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 +# 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 http://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 +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 +Py2pack: Generate distribution packages from PyPI +================================================= + +.. image:: https://travis-ci.org/openSUSE/py2pack.png?branch=master + :target: https://travis-ci.org/openSUSE/py2pack + + +This script allows to generate RPM spec or DEB dsc files from Python modules. +It allows to list Python modules or search for them on the Python Package Index +(PyPI). Conveniently, it can fetch tarballs and changelogs making it an +universal tool to package Python modules. + + +Installation +------------ + +To install py2pack from the `Python Package Index`_, simply: + +.. code-block:: bash + + $ pip install py2pack + +Or, if you absolutely must: + +.. code-block:: bash + + $ easy_install py2pack + +But, you really shouldn't do that. Lastly, you can check your distro of choice +if they provide packages. For openSUSE, you can find packages in the `Open +Build Service`_ for all releases. If you happen to use openSUSE:Factory (the +rolling release / development version), simply: + +.. code-block:: bash + + $ sudo zypper install python-py2pack + + +Usage +----- + +Lets suppose you want to package zope.interface_ and you don't know how it is named +exactly. First of all, you can search for it and download the source tarball if +you found the correct module: + +.. code-block:: bash + + $ py2pack search zope.interface + searching for module zope.interface... + found zope.interface-3.6.1 + $ py2pack fetch zope.interface + downloading package zope.interface-3.6.1... + from http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.6.1.tar.gz + + +As a next step you may want to generate a package recipe for your distribution. +For RPM_-based distributions (let's use openSUSE_ as an example), you want to +generate a spec file (named 'python-zope.interface.spec'): + +.. code-block:: bash + + $ py2pack generate zope.interface -t opensuse.spec -f python-zope.interface.spec + +The source tarball and the package recipe is all you need to generate the RPM_ +(or DEB_) file. +This final step may depend on which distribution you use. Again, +for openSUSE_ (and by using the `Open Build Service`_), the complete recipe is: + +.. code-block:: bash + + $ osc mkpac python-zope.interface + $ cd python-zope.interface + $ py2pack fetch zope.interface + $ py2pack generate zope.interface -f python-zope.interface.spec + $ osc build + ... + +Depending on the module, you may have to adapt the resulting spec file slightly. +To get further help about py2pack usage, issue the following command: + +.. code-block:: bash + + $ py2pack help + + +Hacking and contributing +------------------------ + +You can test py2pack from your git checkout by executing the py2pack module: + +.. code-block:: bash + + $ python -m py2pack + +Fork `the repository`_ on Github to start making your changes to the **master** +branch (or branch off of it). Don't forget to write a test for fixed issues or +implemented features whenever appropriate. You can invoke the testsuite from +the repository root directory via `tox`_: + +.. code-block:: bash + + $ tox + +To run a single test class via `tox`_, use i.e.: + +.. code-block:: bash + + $ tox -epy27 test.test_py2pack:Py2packTestCase + + +You can also run `nose`_ directly: + +.. code-block:: bash + + $ nosetests + +It assumes you have the test dependencies installed (available on PYTHONPATH) +on your system. + +:copyright: (c) 2013 Sascha Peilicke. +:license: Apache-2.0, see LICENSE for more details. + + +.. _argparse: http://pypi.python.org/pypi/argparse +.. _Jinja2: http://pypi.python.org/pypi/Jinja2 +.. _zope.interface: http://pypi.python.org/pypi/zope.interface/ +.. _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 +.. _`the repository`: https://github.com/openSUSE/py2pack +.. _`nose`: https://nose.readthedocs.org +.. _`tox`: http://testrun.org/tox + +%prep +%setup -q -n py2pack-%{version} + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%files %{python_files} +%{python_sitelib}/* + +%changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/test_py2pack.py new/py2pack-0.8.2/test/test_py2pack.py --- old/py2pack-0.8.1/test/test_py2pack.py 2017-08-11 10:15:02.000000000 +0200 +++ new/py2pack-0.8.2/test/test_py2pack.py 2017-12-22 10:45:48.000000000 +0100 @@ -29,6 +29,7 @@ class Args: name = "py2pack" version = "0.4.4" + source_url = None self.args = Args() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py2pack-0.8.1/test/test_template.py new/py2pack-0.8.2/test/test_template.py --- old/py2pack-0.8.1/test/test_template.py 1970-01-01 01:00:00.000000000 +0100 +++ new/py2pack-0.8.2/test/test_template.py 2017-12-22 10:45:48.000000000 +0100 @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2017, Sebastian Wagner <[email protected]> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import os.path +import pwd +import tempfile +import unittest + +import py2pack + + +class Args(object): + run = False + template = '' + filename = '' + name = 'py2pack' + version = '0.8.0' + 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 + py2pack.generate(args) + filehandle.seek(0) + 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) + 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))
