How can I disable pyc and pyo file generation?

Autotools insists on creating pyo and pyc files when creating my project (and not when it starts) no matter what I do. The problem is that my Python configuration is somewhat weird, and I don't want the Python compiler to start during installation. Is there any way to disable the creation of these files?

For reference, here is what I tried:

  • Setting py_compile = echo so automake will not compile Python scripts
  • Manually define install-pythonPYTHON in Makefile.am
  • Setting PYTHONFLAGS = -B
  • Setting PYTHONDONTWRITEBYTECODE in Makefile.am, configure.ac, etc.
  • Creating a new automake variable "python2dir" and setting the script using dist_python2_DATA = Script.py

Basically, if the file ends with a .py extension, Automake WILL creates the pyc and pyo files, no matter what you do.

+4
source share
2 answers

Please try again from the last attempt.

dist_python_DATA = foo.py 

will handle foo.py like any regular file, distribute it and install it in $(pythondir) . _DATA does not cause any compilation.

+2
source

See the -B option in the documentation .

+3
source

Source: https://habr.com/ru/post/1416596/


All Articles