Hello, On Mar 14 14:15 Michael Matz wrote (excerpt):
On Mon, 14 Mar 2016, Bernhard M. Wiedemann wrote:
Python packages are tricky to get right, because .pyc and .pyo files contain timestamps of their source file and will not be used unless it matches exactly. Why do we (and redhat) even include them? In Debian packages have only .py files and the precompiled .pyc files get added upon package installation.
I wonder if .pyc or .pyo bring any advantages at all at this time?
I am not all all a Python expert but I had some trouble with precompiled .pyc and .pyo files in the hplip package that lead in the end to the following "current solution": --------------------------------------------------------------------- $ osc cat Printing hplip hplip.spec | less ... # Make and install Python compiled bytecode files # (.pyc compiled python and .pyo optimized compiled python) # because normal users do not have write permissions # to the install location /usr/share/hplip/ so that # for normal users Python would recompile the sources # every time which results longer program startup time # and waste of CPU for compiling, # see https://en.opensuse.org/openSUSE:Packaging_Python#Byte_Compiled_Files # and http://lists.opensuse.org/opensuse-packaging/2014-10/msg00028.html # Make and install .pyc files: %py_compile %{buildroot}%{_datadir}/hplip # Make and install .pyo files: %py_compile -O %{buildroot}%{_datadir}/hplip # Hardlink .pyc and .pyo when they have same content. # Do not run "fdupes buildroot/_datadir/hplip" because # fdupes will link any files with same content there # which can have unexpected side-effects, compare # https://bugzilla.opensuse.org/show_bug.cgi?id=784670 for pyc in $( find %{buildroot}%{_datadir}/hplip -name '*.pyc' ) do pyo="${pyc%.pyc}.pyo" if test -f $pyo && cmp -s $pyc $pyo then echo hardlinking $pyc and $pyo because both have same content ln -f $pyc $pyo fi done --------------------------------------------------------------------- Kind Regards Johannes Meixner -- SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard, Graham Norton - HRB 21284 (AG Nuernberg) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org