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

2016-11-06 Thread Ivan Pozdeev via Python-list
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__=path>;

exec(compile(getattr(tokenize, 'open', open)(__file__).read()
.replace('\\r\\n', '\\n'), __file__, 'exec'))" 

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

--
https://mail.python.org/mailman/listinfo/python-list


Re: Confused with installing per-user in Windows

2016-11-06 Thread Ivan Pozdeev via Python-list

On 07.11.2016 4:11, ddbug wrote:

Dear experts,

I need to install some scripts for current user (to skip sudo, UAC popups and 
whatever).

So I make a sdist and use python -m pip install --user 

This should work for either Python 2 or 3.

On Linux, pip installs the scripts into ~/.local/bin ; users are instructed to 
add this to their PATH if they have not done so already.

In Windows, the user-local directory for scripts is %APPDATA%\Python\Scripts. 
It is not in PATH by default and finding it is hard (because Microsoft made it 
hidden in their infinite wisdom).

But more to this, either Python (2.7 or 3.5) will NOT look there by default. When user types "python 
myscript.py" or "py myscript.py" he is baffled by "not found".
If `myscript.py' is in the system-wide Scripts (or anywhere else other 
that current dir), "python myscript.py" will yield "not found" all the same.


Now, the question:

1. would it be good if python interpreter could JUST find user-local scripts - 
by default or by some easy configuration option?
Just append `%APPDATA%\Python\Scripts' into your user-specific PATH and 
use "myscript.py" (without "python") - that will search for the file on 
PATH and run it with whatever program you have associated with the `.py' 
extension (which should be `py.exe' if you're using it).


2. If not, would it be good to put this smartness into the PY.EXE launcher, 
make this behavior default or by a simple command line option?

So that user can be instructed to type "py myscript [.py]"  and it will JUST 
work, if the script is on existing PATH or in the per-user directory?


I know about bdist_wininst and Windows specific install options, but prefer 
single sdist installer whenever possible.

Thanks for reading.

--d


--
Regards,
Ivan

--
https://mail.python.org/mailman/listinfo/python-list