I'm trying to install a package with setuptools
including console_scripts
on Windows 7. I'm trying to change the value of my PYTHONUSERBASE
to install into a custom directory with the --user
flag. If I use backslashes in the value of PYTHONUSERBASE
, as in
set PYTHONUSERBASE=C:\testing
everything works fine. However, if I use a forward slash, as in
set PYTHONUSERBASE=C:/testing
the package itself installs to the right place, but the console_scripts
(and only the console_scripts
) are installed into C:testing\Scripts
. Obviously, when the forward slash is present, setuptools
is treating the path as a relative path only for the console_scripts
. In my real package, I'm reading values from a configuration file, so I would really rather not have to deal with normalizing the path separator since it needs to work on Linux as well. For testing, I have a package with the structure
|-- setup.py
|-- foobar\
|---- __init__.py
|---- __main__.py
The code in the __main__.py
is
def main(): print('This is the main function')
and setup.py
looks like:
from setuptools import setup
setup(
name='foobar',
version='1.0.0',
packages=['foobar'],
entry_points={
'console_scripts': [
'foobar=foobar.__main__:main',
],
},
)
Why is setuptools
stripping out the first forward slash in the path and how can I fix it? I think this question is related to my problem, but I don't think it solves it: Python os.path.join on Windows