Hi all, for past few days, I've been working on a project called pyp2rpm. It's a tool that allows you to easily convert python package from PyPI to an RPM specfile. I would like to get it tested before I package it into Fedora, so if anyone is interested, here are the links:
http://pypi.python.org/pypi/pyp2rpm https://bitbucket.org/bkabrda/pyp2rpm
You can install pyp2rpm by running "easy_install pyp2rpm" or "pip-python install pyp2rpm".
I will be glad for any comments/suggestions for improvement (including comments like "hey, I don't understand your readme nor help and I don't know how to use that!", which is why i intentionally didn't put any information about usage here :) ).
Thanks!
On 05/23/2012 04:06 PM, Bohuslav Kabrda wrote:
Hi all, for past few days, I've been working on a project called pyp2rpm. It's a tool that allows you to easily convert python package from PyPI to an RPM specfile. I would like to get it tested before I package it into Fedora, so if anyone is interested, here are the links:
http://pypi.python.org/pypi/pyp2rpm https://bitbucket.org/bkabrda/pyp2rpm
You can install pyp2rpm by running "easy_install pyp2rpm" or "pip-python install pyp2rpm".
I will be glad for any comments/suggestions for improvement (including comments like "hey, I don't understand your readme nor help and I don't know how to use that!", which is why i intentionally didn't put any information about usage here :) ).
How does this compare to Tarek Ziade's existing pypi2rpm project?
From a quick look, the main difference appears to be that pyp2rpm
creates a spec file only, while pypi2rpm creates the RPM directly.
Cheers, Nick.
On 23/05/12 08:16, Nick Coghlan wrote:
How does this compare to Tarek Ziade's existing pypi2rpm project?
From a quick look, the main difference appears to be that pyp2rpm creates a spec file only, while pypi2rpm creates the RPM directly.
Pyp2rpm supports a packager to create an initial spec. Using pypi2rpm there's IMHO no way to get produced rpms into fedora. (because of missing srpm)
If you don't care about that, I guess, pypi2rpm will be good enough.
Matthias
----- Original Message -----
On 23/05/12 08:16, Nick Coghlan wrote:
How does this compare to Tarek Ziade's existing pypi2rpm project?
From a quick look, the main difference appears to be that pyp2rpm creates a spec file only, while pypi2rpm creates the RPM directly.
Pyp2rpm supports a packager to create an initial spec. Using pypi2rpm there's IMHO no way to get produced rpms into fedora. (because of missing srpm)
If you don't care about that, I guess, pypi2rpm will be good enough.
Yes, it is exactly as Matthias says.
pyp2rpm is a tool for packager, it creates an rpm specfile, which is prefilled with the automatically extractable data. pypi2rpm is a tool for user who wants to create binary rpms, but it can't produce specfile nor srpm in any form.
On 05/23/2012 04:30 PM, Bohuslav Kabrda wrote:
----- Original Message -----
On 23/05/12 08:16, Nick Coghlan wrote:
How does this compare to Tarek Ziade's existing pypi2rpm project?
From a quick look, the main difference appears to be that pyp2rpm creates a spec file only, while pypi2rpm creates the RPM directly.
Pyp2rpm supports a packager to create an initial spec. Using pypi2rpm there's IMHO no way to get produced rpms into fedora. (because of missing srpm)
If you don't care about that, I guess, pypi2rpm will be good enough.
Yes, it is exactly as Matthias says.
pyp2rpm is a tool for packager, it creates an rpm specfile, which is prefilled with the automatically extractable data. pypi2rpm is a tool for user who wants to create binary rpms, but it can't produce specfile nor srpm in any form.
Thanks, that makes sense - I hadn't really looked closely at pypi2rpm until today (it had only been on my "learn more about this" list) so I hadn't noticed the limitation. I'd previously tried using py2pack to create SPEC files, and they required a lot of subsequent tweaking to bring them up to something I considered acceptable (and that wasn't even trying to get them up to full Fedora packaging standards).
Perhaps having "spec" or "srpm" in the name would make the difference more obvious?
Regarding pyp2rpm itself, running "pip install pyp2rpm" (or "easy_install pyp2rpm") on my Fedora 16 workstation gives me a traceback with "RuntimeError: That compression method is not supported".
Regards, Nick.
----- Original Message -----
On 05/23/2012 04:30 PM, Bohuslav Kabrda wrote:
----- Original Message -----
On 23/05/12 08:16, Nick Coghlan wrote:
How does this compare to Tarek Ziade's existing pypi2rpm project?
From a quick look, the main difference appears to be that pyp2rpm creates a spec file only, while pypi2rpm creates the RPM directly.
Pyp2rpm supports a packager to create an initial spec. Using pypi2rpm there's IMHO no way to get produced rpms into fedora. (because of missing srpm)
If you don't care about that, I guess, pypi2rpm will be good enough.
Yes, it is exactly as Matthias says.
pyp2rpm is a tool for packager, it creates an rpm specfile, which is prefilled with the automatically extractable data. pypi2rpm is a tool for user who wants to create binary rpms, but it can't produce specfile nor srpm in any form.
Thanks, that makes sense - I hadn't really looked closely at pypi2rpm until today (it had only been on my "learn more about this" list) so I hadn't noticed the limitation. I'd previously tried using py2pack to create SPEC files, and they required a lot of subsequent tweaking to bring them up to something I considered acceptable (and that wasn't even trying to get them up to full Fedora packaging standards).
Perhaps having "spec" or "srpm" in the name would make the difference more obvious?
Regarding pyp2rpm itself, running "pip install pyp2rpm" (or "easy_install pyp2rpm") on my Fedora 16 workstation gives me a traceback with "RuntimeError: That compression method is not supported".
Hmm, that is really strange, this works for me on F17. Could it be that it depends on Python version or tar version it was created with? I created the package on F17.
Regards, Nick.
-- Nick Coghlan Red Hat Infrastructure Engineering & Development, Brisbane _______________________________________________ python-devel mailing list python-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/python-devel
On 05/23/2012 04:57 PM, Bohuslav Kabrda wrote:
Regarding pyp2rpm itself, running "pip install pyp2rpm" (or "easy_install pyp2rpm") on my Fedora 16 workstation gives me a traceback with "RuntimeError: That compression method is not supported".
Hmm, that is really strange, this works for me on F17. Could it be that it depends on Python version or tar version it was created with? I created the package on F17.
I'm stumped. I downloaded the tarball and unpacked it with Ark to see if the unpack step was the source of the problem. I then ran setup.py directly and got the output below.
$ sudo python setup.py install running install running bdist_egg running egg_info writing requirements to pyp2rpm.egg-info/requires.txt writing pyp2rpm.egg-info/PKG-INFO writing top-level names to pyp2rpm.egg-info/top_level.txt writing dependency_links to pyp2rpm.egg-info/dependency_links.txt reading manifest file 'pyp2rpm.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'pyp2rpm.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/utils.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/package_data.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/version.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/archive.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/settings.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/filters.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/exceptions.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib creating build/bdist.linux-x86_64/egg/pyp2rpmlib/templates copying build/lib/pyp2rpmlib/templates/macros.spec -> build/bdist.linux-x86_64/egg/pyp2rpmlib/templates copying build/lib/pyp2rpmlib/templates/fedora.spec -> build/bdist.linux-x86_64/egg/pyp2rpmlib/templates copying build/lib/pyp2rpmlib/dependency_parser.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/package_getters.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/metadata_extractors.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/__init__.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/convertor.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/utils.py to utils.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/package_data.py to package_data.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/version.py to version.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/archive.py to archive.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/settings.py to settings.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/filters.py to filters.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/exceptions.py to exceptions.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/dependency_parser.py to dependency_parser.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/package_getters.py to package_getters.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/metadata_extractors.py to metadata_extractors.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/__init__.py to __init__.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/convertor.py to convertor.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts running install_scripts running build_scripts creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-2.7/pyp2rpm -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/pyp2rpm to 755 copying pyp2rpm.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist/pyp2rpm-0.4.0-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing pyp2rpm-0.4.0-py2.7.egg creating /usr/lib/python2.7/site-packages/pyp2rpm-0.4.0-py2.7.egg Extracting pyp2rpm-0.4.0-py2.7.egg to /usr/lib/python2.7/site-packages Traceback (most recent call last): File "setup.py", line 39, in <module> 'Topic :: System :: Software Distribution', File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 73, in run self.do_egg_install() File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 101, in do_egg_install cmd.run() File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 349, in run self.easy_install(spec, not self.no_deps) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 569, in easy_install return self.install_item(None, spec, tmpdir, deps, True) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 619, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 773, in install_eggs return [self.install_egg(dist_filename, tmpdir)] File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 847, in install_egg (os.path.basename(egg_path),os.path.dirname(destination))) File "/usr/lib64/python2.7/distutils/cmd.py", line 349, in execute util.execute(func, args, msg, dry_run=self.dry_run) File "/usr/lib64/python2.7/distutils/util.py", line 404, in execute func(*args) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1152, in unpack_and_compile unpack_archive(egg_path, destination, pf) File "/usr/lib/python2.7/site-packages/setuptools/archive_util.py", line 67, in unpack_archive driver(filename, extract_dir, progress_filter) File "/usr/lib/python2.7/site-packages/setuptools/archive_util.py", line 154, in unpack_zipfile data = z.read(info.filename) File "/usr/lib64/python2.7/zipfile.py", line 869, in read return self.open(name, "r", pwd).read() File "/usr/lib64/python2.7/zipfile.py", line 683, in __init__ raise RuntimeError, "That compression method is not supported" RuntimeError: That compression method is not supported
----- Original Message -----
On 05/23/2012 04:57 PM, Bohuslav Kabrda wrote:
Regarding pyp2rpm itself, running "pip install pyp2rpm" (or "easy_install pyp2rpm") on my Fedora 16 workstation gives me a traceback with "RuntimeError: That compression method is not supported".
Hmm, that is really strange, this works for me on F17. Could it be that it depends on Python version or tar version it was created with? I created the package on F17.
I'm stumped. I downloaded the tarball and unpacked it with Ark to see if the unpack step was the source of the problem. I then ran setup.py directly and got the output below.
$ sudo python setup.py install running install running bdist_egg running egg_info writing requirements to pyp2rpm.egg-info/requires.txt writing pyp2rpm.egg-info/PKG-INFO writing top-level names to pyp2rpm.egg-info/top_level.txt writing dependency_links to pyp2rpm.egg-info/dependency_links.txt reading manifest file 'pyp2rpm.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'pyp2rpm.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/utils.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/package_data.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/version.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/archive.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/settings.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/filters.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/exceptions.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib creating build/bdist.linux-x86_64/egg/pyp2rpmlib/templates copying build/lib/pyp2rpmlib/templates/macros.spec -> build/bdist.linux-x86_64/egg/pyp2rpmlib/templates copying build/lib/pyp2rpmlib/templates/fedora.spec -> build/bdist.linux-x86_64/egg/pyp2rpmlib/templates copying build/lib/pyp2rpmlib/dependency_parser.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/package_getters.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/metadata_extractors.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/__init__.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib copying build/lib/pyp2rpmlib/convertor.py -> build/bdist.linux-x86_64/egg/pyp2rpmlib byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/utils.py to utils.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/package_data.py to package_data.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/version.py to version.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/archive.py to archive.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/settings.py to settings.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/filters.py to filters.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/exceptions.py to exceptions.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/dependency_parser.py to dependency_parser.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/package_getters.py to package_getters.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/metadata_extractors.py to metadata_extractors.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/__init__.py to __init__.pyc byte-compiling build/bdist.linux-x86_64/egg/pyp2rpmlib/convertor.py to convertor.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts running install_scripts running build_scripts creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-2.7/pyp2rpm -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/pyp2rpm to 755 copying pyp2rpm.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying pyp2rpm.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist/pyp2rpm-0.4.0-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing pyp2rpm-0.4.0-py2.7.egg creating /usr/lib/python2.7/site-packages/pyp2rpm-0.4.0-py2.7.egg Extracting pyp2rpm-0.4.0-py2.7.egg to /usr/lib/python2.7/site-packages Traceback (most recent call last): File "setup.py", line 39, in <module> 'Topic :: System :: Software Distribution', File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 73, in run self.do_egg_install() File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 101, in do_egg_install cmd.run() File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 349, in run self.easy_install(spec, not self.no_deps) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 569, in easy_install return self.install_item(None, spec, tmpdir, deps, True) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 619, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 773, in install_eggs return [self.install_egg(dist_filename, tmpdir)] File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 847, in install_egg (os.path.basename(egg_path),os.path.dirname(destination))) File "/usr/lib64/python2.7/distutils/cmd.py", line 349, in execute util.execute(func, args, msg, dry_run=self.dry_run) File "/usr/lib64/python2.7/distutils/util.py", line 404, in execute func(*args) File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1152, in unpack_and_compile unpack_archive(egg_path, destination, pf) File "/usr/lib/python2.7/site-packages/setuptools/archive_util.py", line 67, in unpack_archive driver(filename, extract_dir, progress_filter) File "/usr/lib/python2.7/site-packages/setuptools/archive_util.py", line 154, in unpack_zipfile data = z.read(info.filename) File "/usr/lib64/python2.7/zipfile.py", line 869, in read return self.open(name, "r", pwd).read() File "/usr/lib64/python2.7/zipfile.py", line 683, in __init__ raise RuntimeError, "That compression method is not supported" RuntimeError: That compression method is not supported
Yes, I can reproduce that. It seems to be a problem in the distribute package (a.k.a. python-setuptools in Fedora). I released version 0.4.1, that uses Python's internal distutils and should install fine. I will investigate this issue and let you know when I find out what's wrong.
Thanks :)
-- Nick Coghlan Red Hat Infrastructure Engineering & Development, Brisbane _______________________________________________ python-devel mailing list python-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/python-devel
On 05/23/2012 06:00 PM, Bohuslav Kabrda wrote:
Yes, I can reproduce that. It seems to be a problem in the distribute package (a.k.a. python-setuptools in Fedora). I released version 0.4.1, that uses Python's internal distutils and should install fine. I will investigate this issue and let you know when I find out what's wrong.
Yep, 0.4.1 pip installs fine. I ran it over the parse module (which is a test dependency I know I'm currently missing if I try to run my tests from an RPM install) just to try it out.
I'll explore more tomorrow on what's involved in tweaking the templates.
Cheers, Nick.
Bohuslav Kabrda wrote:
line 154, in unpack_zipfile data = z.read(info.filename) File "/usr/lib64/python2.7/zipfile.py", line 869, in read return self.open(name, "r", pwd).read() File "/usr/lib64/python2.7/zipfile.py", line 683, in __init__ raise RuntimeError, "That compression method is not supported" RuntimeError: That compression method is not supported
Same for me on F15.
Yes, I can reproduce that. It seems to be a problem in the distribute package (a.k.a. python-setuptools in Fedora). I released version 0.4.1, that uses Python's internal distutils and should install fine. I will investigate this issue and let you know when I find out what's wrong.
No, it's a problem with your monkeypatching of zipfile in pyp2rpmlib/archive.py(12):
# monkey patch ZipFile to behave like TarFile ZipFile.getmembers = ZipFile.infolist ZipFile.extractfile = ZipFile.open ZipFile.open = ZipFile # this line is at fault here ZipInfo.name = ZipInfo.filename
Real zipfile.ZipFile.open opens member of archive not an archive itself. So in code above z.read(info.filename) ends up calling ZipFile instead of real zipfile.ZipFile.open, providing wrong aruments.
----- Original Message -----
Bohuslav Kabrda wrote:
line 154, in unpack_zipfile data = z.read(info.filename) File "/usr/lib64/python2.7/zipfile.py", line 869, in read return self.open(name, "r", pwd).read() File "/usr/lib64/python2.7/zipfile.py", line 683, in __init__ raise RuntimeError, "That compression method is not supported" RuntimeError: That compression method is not supported
Same for me on F15.
Yes, I can reproduce that. It seems to be a problem in the distribute package (a.k.a. python-setuptools in Fedora). I released version 0.4.1, that uses Python's internal distutils and should install fine. I will investigate this issue and let you know when I find out what's wrong.
No, it's a problem with your monkeypatching of zipfile in pyp2rpmlib/archive.py(12):
# monkey patch ZipFile to behave like TarFile ZipFile.getmembers = ZipFile.infolist ZipFile.extractfile = ZipFile.open ZipFile.open = ZipFile # this line is at fault here ZipInfo.name = ZipInfo.filename
Real zipfile.ZipFile.open opens member of archive not an archive itself. So in code above z.read(info.filename) ends up calling ZipFile instead of real zipfile.ZipFile.open, providing wrong aruments.
-- Zart
Thanks a lot... I didn't know that all the modules get imported during install... I guess moving that code somewhere to the archive class will do fine.
python-devel mailing list python-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/python-devel
Bohuslav Kabrda wrote:
Thanks a lot... I didn't know that all the modules get imported during install... I guess moving that code somewhere to the archive class will do fine.
Your own setup.py contains explicit import from pyp2rpmlib, thus monkeypatching happens even before setuptools/distribute gets imported.
On 05/23/2012 06:55 PM, Bohuslav Kabrda wrote:
# monkey patch ZipFile to behave like TarFile ZipFile.getmembers = ZipFile.infolist ZipFile.extractfile = ZipFile.open ZipFile.open = ZipFile # this line is at fault here ZipInfo.name = ZipInfo.filename
Real zipfile.ZipFile.open opens member of archive not an archive itself. So in code above z.read(info.filename) ends up calling ZipFile instead of real zipfile.ZipFile.open, providing wrong aruments.
-- Zart
Thanks a lot... I didn't know that all the modules get imported during install... I guess moving that code somewhere to the archive class will do fine.
Is monkeypatching really necessary here? Monkeypatching affects global process state (i.e. class definitions in imported modules), so it's a fairly extreme approach to the problem of inconsistent method names that prevent duck-typing. It's generally preferable to use a wrapper class or a custom subclass to adapt between the two APIs at the point of use rather than changing state that can be seen by every other module that gets imported into the same process.
Cheers, Nick.
----- Original Message -----
On 05/23/2012 06:55 PM, Bohuslav Kabrda wrote:
# monkey patch ZipFile to behave like TarFile ZipFile.getmembers = ZipFile.infolist ZipFile.extractfile = ZipFile.open ZipFile.open = ZipFile # this line is at fault here ZipInfo.name = ZipInfo.filename
Real zipfile.ZipFile.open opens member of archive not an archive itself. So in code above z.read(info.filename) ends up calling ZipFile instead of real zipfile.ZipFile.open, providing wrong aruments.
-- Zart
Thanks a lot... I didn't know that all the modules get imported during install... I guess moving that code somewhere to the archive class will do fine.
Is monkeypatching really necessary here? Monkeypatching affects global process state (i.e. class definitions in imported modules), so it's a fairly extreme approach to the problem of inconsistent method names that prevent duck-typing. It's generally preferable to use a wrapper class or a custom subclass to adapt between the two APIs at the point of use rather than changing state that can be seen by every other module that gets imported into the same process.
Cheers, Nick.
I agree that monkey patching is not necessary, but it certainly makes things easier. I considered creating the wrapper class, but monkey patching just seemed as a better option ATM. Having said that, I'm open to any suggestions and I will rethink this as the library grows much larger than I previously thought it would.
-- Nick Coghlan Red Hat Infrastructure Engineering & Development, Brisbane _______________________________________________ python-devel mailing list python-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/python-devel
----- Original Message -----
Hi all, for past few days, I've been working on a project called pyp2rpm. It's a tool that allows you to easily convert python package from PyPI to an RPM specfile. I would like to get it tested before I package it into Fedora, so if anyone is interested, here are the links:
http://pypi.python.org/pypi/pyp2rpm https://bitbucket.org/bkabrda/pyp2rpm
You can install pyp2rpm by running "easy_install pyp2rpm" or "pip-python install pyp2rpm".
I will be glad for any comments/suggestions for improvement (including comments like "hey, I don't understand your readme nor help and I don't know how to use that!", which is why i intentionally didn't put any information about usage here :) ).
Thanks!
-- Regards, Bohuslav "Slavek" Kabrda.
After adding some more functionality and, I finally packaged pyp2rpm for Fedora (thanks to Matthias Runge for review). So far it's only for F17 and rawhide, but I may add it for older releases if someone wishes. Here is the bodhi link for F17: https://admin.fedoraproject.org/updates/pyp2rpm-0.5.1-1.fc17
Enjoy!
On 19/06/12 16:16, Bohuslav Kabrda wrote:
After adding some more functionality and, I finally packaged pyp2rpm for Fedora (thanks to Matthias Runge for review). So far it's only for F17 and rawhide, but I may add it for older releases if someone wishes. Here is the bodhi link for F17: https://admin.fedoraproject.org/updates/pyp2rpm-0.5.1-1.fc17
Enjoy!
It works very well, just give it a shot.
Great work Slavek, thank you!
python-devel@lists.fedoraproject.org