From a4c23671f28022e5818b7406924bf34d28d28ef1 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 7 Apr 2020 14:40:58 +0200 Subject: [PATCH] Updated to 2.1.0 for libcdio-2.1.0 update --- python-pycdio.spec | 12 +-- python3.patch | 257 --------------------------------------------- 2 files changed, 6 insertions(+), 263 deletions(-) delete mode 100644 python3.patch diff --git a/python-pycdio.spec b/python-pycdio.spec index f2c21c6..1447e34 100644 --- a/python-pycdio.spec +++ b/python-pycdio.spec @@ -1,14 +1,11 @@ Name: python-pycdio -Version: 2.0.0 -Release: 8%{?dist} +Version: 2.1.0 +Release: 1%{?dist} Summary: A Python interface to the CD Input and Control library License: GPLv3+ URL: http://www.gnu.org/software/libcdio/ Source0: %pypi_source pycdio -# https://git.savannah.gnu.org/cgit/libcdio/pycdio.git/commit/?id=4c68c5a44f98a7cf3fa388ca66c7d312e44e78df -# https://savannah.gnu.org/bugs/?56739 -Patch0: python3.patch BuildRequires: gcc BuildRequires: python3-devel @@ -50,7 +47,7 @@ chmod 755 %{buildroot}/%{python3_sitearch}/*.so %files -n python3-pycdio %license COPYING -%doc README.rst ChangeLog AUTHORS NEWS THANKS +%doc README.rst ChangeLog AUTHORS NEWS.md THANKS %{python3_sitearch}/__pycache__/* %{python3_sitearch}/_pycdio* %{python3_sitearch}/_pyiso9660* @@ -61,6 +58,9 @@ chmod 755 %{buildroot}/%{python3_sitearch}/*.so %{python3_sitearch}/pycdio-%{version}-py3*.egg-info/ %changelog +* Mon Mar 30 2020 Adrian Reber - 2.1.0-1 +- Updated to 2.1.0 for libcdio-2.1.0 update + * Thu Jan 30 2020 Fedora Release Engineering - 2.0.0-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/python3.patch b/python3.patch deleted file mode 100644 index 89050c5..0000000 --- a/python3.patch +++ /dev/null @@ -1,257 +0,0 @@ -commit 4c68c5a44f98a7cf3fa388ca66c7d312e44e78df -Author: rocky -Date: Sun Aug 11 16:54:52 2019 -0400 - - Adjust for Python 3. - - See https://savannah.gnu.org/bugs/?56739 - -diff --git a/README.rst b/README.rst -index 5acd1a9..3643f32 100644 ---- a/README.rst -+++ b/README.rst -@@ -67,11 +67,12 @@ To build on Debian (e.g. Ubuntu): - - :: - -- apt-get install python-dev -- apt-get install libcdio-dev -- apt-get install libiso9660-dev -- apt-get install swig pkg-config -- -+ $ apt-get install python-dev -+ $ apt-get install libcdio-dev -+ $ apt-get install libiso9660-dev -+ $ apt-get install swig pkg-config -+ $ pip install -e . -+ $ make check - - Completeness - ============ -diff --git a/cdio.py b/cdio.py -index 9fb7cc8..63843cd 100644 ---- a/cdio.py -+++ b/cdio.py -@@ -19,8 +19,11 @@ and device-dependent properties of a CD-ROM can use this library.""" - - import pycdio - import _pycdio -+import sys - import types - -+PYTHON2 = sys.version_info[0] <= 2 -+ - class DeviceException(Exception): - """General device or driver exceptions""" - -@@ -182,9 +185,10 @@ def have_driver(driver_id): - - Return True if we have driver driver_id. - """ -- if isinstance(driver_id, long) or isinstance(driver_id, int): -+ if (isinstance(driver_id, int) or -+ (PYTHON2 and isinstance(driver_id, long))) : - return pycdio.have_driver(driver_id) -- elif type(driver_id)==bytes and driver_id in drivers: -+ elif type(driver_id) in (bytes, str) and driver_id in drivers: - ret = pycdio.have_driver(drivers[driver_id]) - if ret == 0: return False - if ret == 1: return True -diff --git a/setup.py b/setup.py -index 86101b7..63a5cb9 100755 ---- a/setup.py -+++ b/setup.py -@@ -1,5 +1,5 @@ - #!/usr/bin/env python --# Copyright (C) 2015, 2018 Rocky Bernstein -+# Copyright (C) 2015, 2018-2019 Rocky Bernstein - # - # This program is free software: you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -20,8 +20,16 @@ This gets a bit of package info from __pkginfo__.py file - """ - - # Get the required package information --from __pkginfo__ import modname, VERSION, license, short_desc, \ -- web, author, author_email, classifiers -+from __pkginfo__ import ( -+ modname, -+ VERSION, -+ license, -+ short_desc, -+ web, -+ author, -+ author_email, -+ classifiers, -+) - - from setuptools import setup - from distutils.core import Extension -@@ -32,51 +40,57 @@ import os - import shutil - - top_dir = os.path.dirname(os.path.abspath(__file__)) --README = os.path.join(top_dir, 'README.rst') --pkg_config = os.getenv('PKG_CONFIG') or 'pkg-config' -+README = os.path.join(top_dir, "README.rst") -+pkg_config = os.getenv("PKG_CONFIG") or "pkg-config" -+ - - def rm_file(*paths): -- global top_dir -- toast = os.path.join(top_dir, *paths) -- try: -- os.remove(toast) -- except: -- pass -- return -+ global top_dir -+ toast = os.path.join(top_dir, *paths) -+ try: -+ os.remove(toast) -+ except: -+ pass -+ return -+ - - # Description in package will come from the README file. --long_description = open(README).read() + '\n\n' -+long_description = open(README).read() + "\n\n" - - # We store swig sources in ./swig, but we want the generated python - # module not to appear in that directory, but instead in the top-level - # directory where we have the other modules. I'd move *all* of the modules - # to their own directory if I knew how to do that in distutils. --swig_opts = ['-outdir', top_dir] -+swig_opts = ["-outdir", top_dir] -+ - - class custom_build(build): - # Reorder build commands such that swig generated files are also copied. -- sub_commands = [('build_ext', build.has_ext_modules), -- ('build_py', build.has_pure_modules), -- ('build_clib', build.has_c_libraries), -- ('build_scripts', build.has_scripts)] -+ sub_commands = [ -+ ("build_ext", build.has_ext_modules), -+ ("build_py", build.has_pure_modules), -+ ("build_clib", build.has_c_libraries), -+ ("build_scripts", build.has_scripts), -+ ] - - def run(self): - # Account for API change after 0.83 -- ge_2 = call([pkg_config,'--atleast-version=2.0.0','libcdio']) -+ ge_2 = call([pkg_config, "--atleast-version=2.0.0", "libcdio"]) - assert ge_2 == 0, "Need at least libcdio 2.0.0 to use this" - print("libcdio version >= 2.0.0") - build.run(self) - -+ - # Find runtime library directories for libcdio and libiso9660 using - # pkg-config. Then create the right Extension object lists which later - # get fed into setup()'s list of ext_modules. - modules = [] --for lib_name in ('libcdio', 'libiso9660'): -- short_libname = lib_name[3:] # Strip off "lib" from name -+for lib_name in ("libcdio", "libiso9660"): -+ short_libname = lib_name[3:] # Strip off "lib" from name - - # FIXME: DRY this code. - try: -- p = Popen([pkg_config, '--libs-only-L', lib_name], stdout=PIPE) -+ p = Popen([pkg_config, "--libs-only-L", lib_name], stdout=PIPE) - except: - print("** Error trying to run pkg-config. Is it installed?") - print("** If not, see http://pkg-config.freedesktop.org") -@@ -85,47 +99,56 @@ for lib_name in ('libcdio', 'libiso9660'): - - if p.returncode is None: - # Strip off blanks and initial '-L' -- dirs = p.communicate()[0].split(b'-L')[1:] -+ dirs = p.communicate()[0].split(b"-L")[1:] - runtime_lib_dirs = [d.strip() for d in dirs] - else: -- print(("** Didn't the normal return code running pkg-config," + -- "on %s. got:\n\t%s" % [lib_name, p.returncode])) -+ print( -+ ( -+ "** Didn't the normal return code running pkg-config," -+ + "on %s. got:\n\t%s" % [lib_name, p.returncode] -+ ) -+ ) - print("** Will try to add %s anyway." % short_libname) - runtime_lib_dirs = None - library_dirs = runtime_lib_dirs -- p = Popen([pkg_config, '--cflags-only-I', lib_name], stdout=PIPE) -+ p = Popen([pkg_config, "--cflags-only-I", lib_name], stdout=PIPE) - if p.returncode is None: -- # String starts '-I' so the first entry is ''; Discard that, -- # the others we want. -- dirs = p.communicate()[0].split(b'-I')[1:] -+ # String starts '-I' so the first entry is ''; Discard that, -+ # the others we want. -+ dirs = p.communicate()[0].split(b"-I")[1:] - include_dirs = [d.strip() for d in dirs] -- p = Popen([pkg_config, '--libs-only-l', lib_name], stdout=PIPE) -+ p = Popen([pkg_config, "--libs-only-l", lib_name], stdout=PIPE) - if p.returncode is None: -- # String starts '-l' so the first entry is ''; Discard that, -- # the others we want. -- dirs = p.communicate()[0].split(b'-l')[1:] -+ # String starts '-l' so the first entry is ''; Discard that, -+ # the others we want. -+ dirs = p.communicate()[0].split(b"-l")[1:] - libraries = [d.strip().decode("utf-8") for d in dirs] - pass -- py_shortname = 'py' + short_libname -- modules.append(Extension('_' + py_shortname, -- libraries = libraries, -- swig_opts = swig_opts, -- include_dirs=include_dirs, -- library_dirs=library_dirs, -- runtime_library_dirs=runtime_lib_dirs, -- sources=['swig/%s.i' % py_shortname])) -- --setup (author = author, -- author_email = author_email, -- classifiers = classifiers, -- cmdclass = {'build': custom_build}, -- description = short_desc, -- ext_modules = modules, -- license = license, -- long_description = long_description, -- name = modname, -- py_modules = ['cdio', 'iso9660', 'pycdio', 'pyiso9660'], -- test_suite = 'nose.collector', -- url = web, -- version = VERSION, -- ) -+ py_shortname = "py" + short_libname -+ modules.append( -+ Extension( -+ "_" + py_shortname, -+ libraries=libraries, -+ swig_opts=swig_opts, -+ include_dirs=include_dirs, -+ library_dirs=library_dirs, -+ runtime_library_dirs=runtime_lib_dirs, -+ sources=["swig/%s.i" % py_shortname], -+ ) -+ ) -+ -+setup( -+ author=author, -+ author_email=author_email, -+ classifiers=classifiers, -+ cmdclass={"build": custom_build}, -+ description=short_desc, -+ ext_modules=modules, -+ license=license, -+ long_description=long_description, -+ name=modname, -+ py_modules=["cdio", "iso9660", "pycdio", "pyiso9660"], -+ test_suite="nose.collector", -+ url=web, -+ version=VERSION, -+)