Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   RPM Package Manager (http://www.linux-archive.org/rpm-package-manager/)
-   -   RPM Build Problem: installed but unpackaged .pyo and .pyc files (http://www.linux-archive.org/rpm-package-manager/137912-rpm-build-problem-installed-but-unpackaged-pyo-pyc-files.html)

Beth Stetzler 08-05-2008 03:41 PM

RPM Build Problem: installed but unpackaged .pyo and .pyc files
 
Hello,

I have made a .spec file to build an RPM that is to install some shell
scripts and Python scripts. The Python scripts are giving BUILD
errors. The errors say that the .pyo and .pyc files are installed but
not packaged. I understand Python compiles these at runtime. I'm
hoping someone can assist with how to fix these problems. I have tested
the .py scripts, but I do not see the .pyc and .pyo files. They are not
in the tarball I created. Would Python have put them in a random
location? My Python version is 2.4 and the library directory site
packages is /usr/lib/python2.4/site-packages.


Thanks.

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

08-05-2008 03:48 PM

RPM Build Problem: installed but unpackaged .pyo and .pyc files
 
> I have made a .spec file to build an RPM that is to install some shell
> scripts and Python scripts. The Python scripts are giving BUILD
> errors. The errors say that the .pyo and .pyc files are installed but
> not packaged. I understand Python compiles these at runtime. I'm
> hoping someone can assist with how to fix these problems. I have tested
> the .py scripts, but I do not see the .pyc and .pyo files. They are not
> in the tarball I created. Would Python have put them in a random
> location? My Python version is 2.4 and the library directory site
> packages is /usr/lib/python2.4/site-packages.
>
I usually like my files like this, but you could always go look the some
spec files of other apps that would do the same (off the top of my head one
might be labyrinth).


path/file.py
%ghost path/file.pyc
%ghost path/file.pyo

not sure if there is a better way

-greg


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

"Paul Johnson" 08-05-2008 06:42 PM

RPM Build Problem: installed but unpackaged .pyo and .pyc files
 
On Tue, Aug 5, 2008 at 10:41 AM, Beth Stetzler
<beth.stetzler@usno.navy.mil> wrote:
> Hello,
>
> I have made a .spec file to build an RPM that is to install some shell
> scripts and Python scripts. The Python scripts are giving BUILD errors.
> The errors say that the .pyo and .pyc files are installed but not packaged.
> I understand Python compiles these at runtime. I'm hoping someone can
> assist with how to fix these problems. I have tested the .py scripts, but I
> do not see the .pyc and .pyo files. They are not in the tarball I created.
> Would Python have put them in a random location? My Python version is 2.4
> and the library directory site packages is /usr/lib/python2.4/site-packages.
>

I know of some bandaids for this.

1. Fix your spec file to add the pyc files. Go to your %files directive.

2. Tell RPM to ignore the unpackaged files.
Put this at the top of the spec file:

%define _unpackaged_files_terminate_build 0

3. Install the package "checkInstall". That will generate an RPM "on
the fly" after a make. You will see exactly where all the installed
files go. It does not check anything, it does not make a fully
legitimate spec file. But it does help you see where all the things
get put.

A deeper approach is to fix the install. My python knowledge is
limited, but I *believe* that the you might be smart to keep the pyc
files because they will execute faster than the py versions. Python
won't re-generate the pyc file if it is current, ie based on same py
file as you have. I don't see pyo files resulting from "make
install". I do see them after make.

Other poster is correct. You should get some SRPM files from python
programs and study their spec files.

pj





--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Matthew Miller 08-05-2008 07:00 PM

RPM Build Problem: installed but unpackaged .pyo and .pyc files
 
On Tue, Aug 05, 2008 at 01:42:51PM -0500, Paul Johnson wrote:
> A deeper approach is to fix the install. My python knowledge is
> limited, but I *believe* that the you might be smart to keep the pyc
> files because they will execute faster than the py versions. Python
> won't re-generate the pyc file if it is current, ie based on same py
> file as you have. I don't see pyo files resulting from "make
> install". I do see them after make.
> Other poster is correct. You should get some SRPM files from python
> programs and study their spec files.

It's not necesaarily a general solution for all distributions, but here's
the Fedora guidelines for this:

<http://fedoraproject.org/wiki/Packaging/Python#Byte_Compiled_Files>

In a nutshell, include 'em in %files.

--
Matthew Miller mattdm@mattdm.org <http://mattdm.org/>
Boston University Linux ------> <http://linux.bu.edu/>

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Beth Stetzler 08-05-2008 07:32 PM

RPM Build Problem: installed but unpackaged .pyo and .pyc files
 
Just wanted to say thanks to Tim, Greg, and PJ for your combined help.
I got my RPM to build and install.


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


All times are GMT. The time now is 08:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.