What is currently the recommended way to work with a distutils-based setup.py that requires compilation?

Ivan Pozdeev vano at mail.mipt.ru
Sun Nov 6 16:23:47 EST 2016


https://wiki.python.org/moin/WindowsCompilers has now completely 
replaced instructions for `distutils`-based packages (starting with 
`from distutils.core import setup`) with ones for `setuptools`-based 
ones (starting with `from setuptools import setup`).

However, if I have a `distutils`-based `setup.py`, when I run it, 
`setuptools` is not used - thus the instructions on the page don't work.

It is possible to run a `distutils`-based script through `setuptools`, 
as `pip` does, but it requires the following code 
(https://github.com/pypa/pip/blob/8.1.2/pip/req/req_install.py#L849 ):

     python -u -c "import setuptools, tokenize;__file__=<setup.py full 
path>;
         exec(compile(getattr(tokenize, 'open', open)(__file__).read()
         .replace('\\r\\n', '\\n'), __file__, 'exec'))" <setup.py arguments>

They can't possibly expect me to type that on the command line each 
time, now can they?

I also asked this at http://stackoverflow.com/q/40174932/648265 a couple 
of days ago (to no avail).

-- 

Regards,
Ivan




More information about the Python-list mailing list