packages: authconfig/authconfig.spec - fix python packaging, now things exe...

Jacek Konieczny jajcus at jajcus.net
Fri Apr 20 18:47:37 CEST 2012


On Fri, Apr 20, 2012 at 06:40:53PM +0300, Elan Ruusamäe wrote:
> it doesn't behave here so:
> 
> here it creates .pyc only for imported modules, if invoked via 
> #!/shebang, no .pyc is created for the script itself:
[...]
> > In case if %{_bindir} or %{_sbindir} - no script should be named *.py
> > there (actually there are some, but they should be fixed).
> >
> any explanation why (not that i have against)

The problem is, that if script name is "something.py", then
if any other python script in the same directory does 
'import something' (on purpose or because of a name collision) the
script will be compiled to pyc.

There should be no *.py files in %{_bindir}. If a script is supposed to
be importable, then it should be stored in %{py_sitescriptdir}, and only
a wrapper script should be kept in %{_bindir}.

The wrapper can be something like that:

#!/usr/bin/python
import something
somethig.run()

or

#!/bin/sh
exec /usr/bin/python -m something "$@"

Whatever the module expects.

Greets,
        Jacek


More information about the pld-devel-en mailing list