Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows script launchers missing backslashes in shebang #331

Closed
ghost opened this issue Jan 18, 2015 · 10 comments
Closed

Windows script launchers missing backslashes in shebang #331

ghost opened this issue Jan 18, 2015 · 10 comments
Labels

Comments

@ghost
Copy link

@ghost ghost commented Jan 18, 2015

Originally reported by: ionelmc (Bitbucket: ionelmc, GitHub: ionelmc)


Using Setuptools 12.0, slashes are missing in the shebang for the installed script:

C:\Users\ionel_000\Projects\sandbox>pip uninstall setuptools
Cannot uninstall requirement setuptools, not installed

C:\Users\ionel_000\Projects\sandbox>pip install setuptools==12.0
Collecting setuptools==12.0
  Using cached setuptools-12.0-py2.py3-none-any.whl
Installing collected packages: setuptools

Successfully installed setuptools-12.0

C:\Users\ionel_000\Projects\sandbox>pip install --no-use-wheel nameless
Collecting nameless
  Downloading nameless-0.1.2.tar.gz
    warning: no directories found matching 'examples'
Installing collected packages: nameless
  Running setup.py install for nameless
    warning: no directories found matching 'examples'
    Installing nameless-script.py script to c:\Python27\Scripts
    Installing nameless.exe script to c:\Python27\Scripts
Successfully installed nameless-0.1.2

C:\Users\ionel_000\Projects\sandbox>type c:\Python27\Scripts\nameless-script.py
#!c:Python27python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'nameless==0.1.2','console_scripts','nameless'
__requires__ = 'nameless==0.1.2'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('nameless==0.1.2', 'console_scripts', 'nameless')()
    )

Rolling back to setuptools 11.3.1 demonstrates the behavior previously worked:

C:\Users\ionel_000\Projects\sandbox>pip install setuptools==13.3.1
Collecting setuptools==13.3.1
  Could not find a version that satisfies the requirement setuptools==13.3.1 (from versions: 0.6b1, 0.6b2, 0.6b3, 0.6b4, 0.6rc1, 0.6rc2, 0.6rc3, 0.6rc4, 0.6rc5, 0.6rc6, 0.6rc7, 0.6rc8, 0.6rc9, 0.6rc10, 0.6rc11, 0.7.2, 0.
7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.7.8, 0.8, 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 1.0, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.2, 1.3, 1.3.1, 1.3.2, 1.4, 1.4.1, 1.4.2, 2.0, 2.0.1,
2.0.2, 2.1, 2.1.1, 2.1.2, 2.2, 3.0, 3.0.1, 3.0.2, 3.1, 3.2, 3.3, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5, 3.5.1, 3.5.2, 3.6, 3.7, 3.7.1, 3.8, 3.8.1, 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 5.2, 5.3, 5.4, 5.4.1, 5.4.2, 5.5, 5.5.
1, 5.6, 5.7, 5.8, 6.0.1, 6.0.2, 6.1, 7.0, 8.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.1, 8.2, 8.2.1, 8.3, 9.0, 9.0.1, 9.1, 10.0, 10.0.1, 10.1, 10.2, 10.2.1, 11.0, 11.1, 11.2, 11.3, 11.3.1, 12.0, 12.0.1)
  No distributions matching the version for setuptools==13.3.1

C:\Users\ionel_000\Projects\sandbox>pip install setuptools==11.3.1
Collecting setuptools==11.3.1
  Downloading setuptools-11.3.1-py2.py3-none-any.whl (500kB)
    100% |################################| 503kB 5.1MB/s eta 0:00:01
Installing collected packages: setuptools
  Found existing installation: setuptools 12.0
    Uninstalling setuptools-12.0:
      Successfully uninstalled setuptools-12.0

Successfully installed setuptools-11.3.1

C:\Users\ionel_000\Projects\sandbox>pip install --no-use-wheel -I nameless
Collecting nameless
  Using cached nameless-0.1.2.tar.gz
    warning: no directories found matching 'examples'
Installing collected packages: nameless
  Running setup.py install for nameless
    warning: no directories found matching 'examples'
    Installing nameless-script.py script to c:\Python27\Scripts
    Installing nameless.exe script to c:\Python27\Scripts
Successfully installed nameless-0.1.2

C:\Users\ionel_000\Projects\sandbox>type c:\Python27\Scripts\nameless-script.py
#!c:\Python27\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'nameless==0.1.2','console_scripts','nameless'
__requires__ = 'nameless==0.1.2'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('nameless==0.1.2', 'console_scripts', 'nameless')()
    )

@ghost
Copy link
Author

@ghost ghost commented Jan 18, 2015

Original comment by ionelmc (Bitbucket: ionelmc, GitHub: ionelmc):


Also, no virtualenvs were involved.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


I don't get that error when using only setuptools/easy_install:

> $env:SETUPTOOLS_LAUNCHER='executable'
> easy_install nameless
Searching for nameless
Best match: nameless 0.1.2
Processing nameless-0.1.2-py3.4.egg
nameless 0.1.2 is already the active version in easy-install.pth
Installing nameless-script.py script to c:\python\Scripts
Installing nameless.exe script to c:\python\Scripts

Using c:\python\lib\site-packages\nameless-0.1.2-py3.4.egg
Processing dependencies for nameless
Finished processing dependencies for nameless
> head C:\python\Scripts\nameless-script.py -n 1
#!c:\python\python.EXE

So I suspect that pip is involved, possibly passing a --executable to easy_install.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by ionelmc (Bitbucket: ionelmc, GitHub: ionelmc):


Can you reproduce it with pip?

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Indeed. Using pip replicates your finding in the same environment.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


The issue appears to be with the install_scripts command.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


The issue appears to be that the use of shlex.split() uses a posix mode by default.

>>> import setuptools.command.easy_install as ei
>>> ei.CommandSpec.from_param(sys.executable).as_header()
'#!c:pythonpython.exe\n`
@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Adding test capturing failure where sys.executable loses backslashes on Windows. Ref #331.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Use non-posix semantics in a WindowsCommandSpec and use that class in the Windows script writers. Fixes #331.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


I really despise this fix. There's just so much complexity out there and not a good abstraction for handling it. In any case, I think this fix should work while keeping the support for #188.

@ghost
Copy link
Author

@ghost ghost commented Jan 19, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Fixed in 12.0.3.

@ghost ghost added major bug labels Mar 29, 2016
@ghost ghost closed this Mar 29, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
0 participants