Skip to contentSkip to conversation

package *.py* files

PATCH In review Alexandre Oliva 3 participants 8 messages Jan 17, 2012 – Jan 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package *.py* files

Some post-install rpmbuild defaults byte-compile all packaged python files, so don't bother removing the .pyc files, and package .py* to get both .pyo and .pyc. It wastes a tiny little bit of space, but it makes the spec file portable across a wider range of rpm and python configurations.

---
 ceph.spec.in |   19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)
ceph.spec.in +3 -16
index 3950fd1..d4994b5 100644
@@ -255,10 +255,6 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/ceph/tmp/
 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/ceph/
 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/ceph/
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ceph/
-# remove *.pyc where *.pyo exists
-rm $RPM_BUILD_ROOT/%{python_sitelib}/rados.pyc
-rm $RPM_BUILD_ROOT/%{python_sitelib}/rbd.pyc
-rm $RPM_BUILD_ROOT/%{python_sitelib}/rgw.pyc
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -351,12 +347,6 @@ fi
 %ghost %dir %{_localstatedir}/run/ceph/
 %dir %{_sysconfdir}/ceph/
 /usr/sbin/rcceph
-# not sure why I need to list those for CentOS although they're removed in install
-%if 0%{defined centos_version}
-%{python_sitelib}/rados.pyc
-%{python_sitelib}/rbd.pyc
-%{python_sitelib}/rgw.pyc
-%endif
 %{_libdir}/rados-classes/libcls_rbd.so.*
 %{_libdir}/rados-classes/libcls_rgw.so.*
 
@@ -483,11 +473,8 @@ fi
 #################################################################################
 %files -n python-ceph
 %defattr(-,root,root,-)
-%{python_sitelib}/rados.py
-%{python_sitelib}/rados.pyo
-%{python_sitelib}/rbd.py
-%{python_sitelib}/rbd.pyo
-%{python_sitelib}/rgw.py
-%{python_sitelib}/rgw.pyo
+%{python_sitelib}/rados.py*
+%{python_sitelib}/rbd.py*
+%{python_sitelib}/rgw.py*
 
 %changelog
Signature · 7 lines
1.7.7.5

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer
#1 lore raw
Quoted 6 lines · Alexandre Oliva <oliva <at> lsd.ic.unicamp.br> writes:

Some post-install rpmbuild defaults byte-compile all packaged python files, so don't bother removing the .pyc files, and package .py* to get both .pyo and .pyc. It wastes a tiny little bit of space, but it makes the spec file portable across a wider range of rpm and python configurations.

Just wondering...do you have a concrete issue or an example where this is a problem?

Regards
Holger

#2 lore raw
Quoted 10 lines · Holger Macht
Quoted 6 lines · Alexandre Oliva <oliva <at> lsd.ic.unicamp.br> writes:

Some post-install rpmbuild defaults byte-compile all packaged python files, so don't bother removing the .pyc files, and package .py* to get both .pyo and .pyc. It wastes a tiny little bit of space, but it makes the spec file portable across a wider range of rpm and python configurations.

Just wondering...do you have a concrete issue or an example where this is a problem?

It failed to build on a BLAGified Fedora 16, complaining about the unpackaged .pyc files. It's not just CentOS that creates the .pyc files in brp-python-bytecompile. Plus, they should be packaged (if at all) in python-ceph, but definitely not in the main ceph package.

Another issue I forgot while posting the patch was that there was not a .tar.bz2 available from the ceph site. I ended up recompressing the .gz as .bz2, but if ceph is going to be released compressed as .gz, the spec file ought to be adjusted to reflect that.

Signature · 4 lines
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer
#3 lore raw
Quoted 10 lines · Alexandre Oliva
Quoted 7 lines · Holger Macht
Quoted 6 lines · Alexandre Oliva <oliva <at> lsd.ic.unicamp.br> writes:

Some post-install rpmbuild defaults byte-compile all packaged python files, so don't bother removing the .pyc files, and package .py* to get both .pyo and .pyc. It wastes a tiny little bit of space, but it makes the spec file portable across a wider range of rpm and python configurations.

Quoted 6 lines
Quoted 2 lines

Just wondering...do you have a concrete issue or an example where this is a problem?

It failed to build on a BLAGified Fedora 16, complaining about the unpackaged .pyc files. It's not just CentOS that creates the .pyc files in brp-python-bytecompile.

So the built failed because *.pyo was there and *.pyc wasn't? That is really strange, because I really don't think both are needed. But sure, there might be python configurations out there I don't know of, which can't handle pyo but can do fine with pyc. So maybe we should just always put pyc files in for maximum compatibility across distributions?

Otherwise, if this really makes the build fail for some distributions, go for it. I will not argue about the different build systems because 1) I don't know enough about them (including the one from SUSE) and 2) I don't won't to dig to deep because of some minor issue like this.

Quoted 2 lines

Plus, they should be packaged (if at all) in python-ceph, but definitely not in the main ceph package.

They are packaged in python-ceph.

Quoted 4 lines

Another issue I forgot while posting the patch was that there was not a .tar.bz2 available from the ceph site. I ended up recompressing the .gz as .bz2, but if ceph is going to be released compressed as .gz, the spec file ought to be adjusted to reflect that.

My fault. I also recompressed them at the very start of working on the spec file and changed it accordingly, but I'm fine for changing this back to .gz.

Regards
Holger

#4 lore raw
Quoted 11 lines · Holger Macht
Quoted 10 lines · Alexandre Oliva
Quoted 7 lines · Holger Macht
Quoted 6 lines · Alexandre Oliva <oliva <at> lsd.ic.unicamp.br> writes:

Some post-install rpmbuild defaults byte-compile all packaged python files, so don't bother removing the .pyc files, and package .py* to get both .pyo and .pyc. It wastes a tiny little bit of space, but it makes the spec file portable across a wider range of rpm and python configurations.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Just wondering...do you have a concrete issue or an example where this is a problem?

It failed to build on a BLAGified Fedora 16, complaining about the unpackaged .pyc files. It's not just CentOS that creates the .pyc files in brp-python-bytecompile.

So the built failed because *.pyo was there and *.pyc wasn't?

No, both were there, but the .pyc was (correctly) flagged as not packaged.

Quoted 2 lines

So maybe we should just always put pyc files in for maximum compatibility across distributions?

Yeah.

Quoted 1 line

Otherwise, if this really makes the build fail for some distributions,

The CentOS-only .pyc packaging did not cover other distros that required it, such as Fedora and BLAG, yes.

Quoted 4 lines
Quoted 2 lines

Plus, they should be packaged (if at all) in python-ceph, but definitely not in the main ceph package.

They are packaged in python-ceph.

No, look at the patch. The ugly work-around to package .pyc files on CentOS only was not in python-ceph.

Quoted 3 lines

My fault. I also recompressed them at the very start of working on the spec file and changed it accordingly, but I'm fine for changing this back to .gz.

I'd rather use the smallest available tarball, but we should use whatever ceph publishes. If it's going to be .gz from now on, we have to change the spec file.

Signature · 4 lines
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer
#5 lore raw
Quoted 5 lines · Alexandre Oliva
Quoted 2 lines · Holger Macht

So maybe we should just always put pyc files in for maximum compatibility across distributions?

Yeah.

I should apply this, then?

Quoted 7 lines
Quoted 3 lines

My fault. I also recompressed them at the very start of working on the spec file and changed it accordingly, but I'm fine for changing this back to .gz.

I'd rather use the smallest available tarball, but we should use whatever ceph publishes. If it's going to be .gz from now on, we have to change the spec file.

I'll start doing .bz2 (in addition to .gz) with 0.41.

Thanks!
sage

#6 lore raw
Quoted 8 lines · Sage Weil
Quoted 5 lines · Alexandre Oliva
Quoted 2 lines · Holger Macht

So maybe we should just always put pyc files in for maximum compatibility across distributions?

Yeah.

I should apply this, then?

Ok, fine with me.

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

My fault. I also recompressed them at the very start of working on the spec file and changed it accordingly, but I'm fine for changing this back to .gz.

I'd rather use the smallest available tarball, but we should use whatever ceph publishes. If it's going to be .gz from now on, we have to change the spec file.

I'll start doing .bz2 (in addition to .gz) with 0.41.

Thanks,
Holger

#7 lore raw
In reply to Alexandre Oliva
Quoted 35 lines · Alexandre Oliva
Quoted 11 lines · Holger Macht
Quoted 10 lines · Alexandre Oliva
Quoted 7 lines · Holger Macht
Quoted 6 lines · Alexandre Oliva <oliva <at> lsd.ic.unicamp.br> writes:

Some post-install rpmbuild defaults byte-compile all packaged python files, so don't bother removing the .pyc files, and package .py* to get both .pyo and .pyc. It wastes a tiny little bit of space, but it makes the spec file portable across a wider range of rpm and python configurations.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Just wondering...do you have a concrete issue or an example where this is a problem?

It failed to build on a BLAGified Fedora 16, complaining about the unpackaged .pyc files. It's not just CentOS that creates the .pyc files in brp-python-bytecompile.

So the built failed because *.pyo was there and *.pyc wasn't?

No, both were there, but the .pyc was (correctly) flagged as not packaged.

Quoted 2 lines

So maybe we should just always put pyc files in for maximum compatibility across distributions?

Yeah.

Quoted 1 line

Otherwise, if this really makes the build fail for some distributions,

The CentOS-only .pyc packaging did not cover other distros that required it, such as Fedora and BLAG, yes.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Plus, they should be packaged (if at all) in python-ceph, but definitely not in the main ceph package.

They are packaged in python-ceph.

No, look at the patch. The ugly work-around to package .pyc files on CentOS only was not in python-ceph.

Ok, now I see.

Regards
Holger