简体   繁体   中英

How to remove .pyo anc .pyc from an RPM?

I have a proxy written in python. I want to create an RPM for this. This rpm will just place the appropriate files at their location. and then some python server will pick them. Now my question is that whenever I generate the rpm, I am getting .pyo and .pyc files as well for every .py file. I don't need those pyc and pyo files. Is there any flag or anything that I can do to remove them?

Thank you.

The *.pyc and *.pyo are being automagically compiled by helper scripts in rpm.

The simplest way to disable is to add "exit 0" at the end of the %install section to disable the running of the helper scripts

Otherwise you will need to change your build configuration and redefine the macros that are being appended to the %install script let when building.

I have excluded these .pyc and .pyo files from getting packaged into the RPM by adding lines like this in your RPM specfile:

%files
...
...
%exclude /path_to_files/*.pyc
%exclude /path_to_files/*.pyo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM