--user installation leaves bzr.bat broken on other systems
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Confirmed
|
Undecided
|
Unassigned | ||
Bazaar Windows Installers |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When bzr was installed into PEP 376 style user directory on Windows (i.e., %APPDATA%\Python), it breaks bzr.bat which has hardcoded path to the 'bzr' script. Here's a patch we use with ActivePython/PyPM to correct this. This assumes that 'bzr' has in its shebang the path to python interpreter.
setuptools' entry points uses a similar approach by reading shebang line from the corresponding file and then launching that interpreter.
We also patched mercurial (hg.bat) to behave like this.
Index: bzr-2.2b4/setup.py
=======
--- bzr-2.2b4.
+++ bzr-2.2b4/setup.py 2010-08-19 10:35:52.715083786 -0700
@@ -106,6 +106,21 @@
# Overridden distutils actions
######
+apy_bzr_bat = r'''
+@echo off
+rem Windows Driver script for Bazaar
+
+setlocal
+set BZR=%~f0
+
+rem Use the Python interpreter specified in the shebang of `bzr'
+
+set /p SHEBANG=<"%~dp0bzr"
+set PYTHON=%SHEBANG:~2%
+
+%PYTHON% "%~dp0bzr" %*
+endlocal
+'''
class my_install_
""" Customized install_scripts distutils action.
Create bzr.bat for win32.
@@ -123,7 +138,7 @@
f = file(batch_path, "w")
- f.write(batch_str)
+ f.write(
except Exception:
Changed in bzr: | |
status: | New → In Progress |
Changed in bzr: | |
status: | In Progress → Confirmed |
summary: |
- --user installation leaves bzr.bat broken + --user installation leaves bzr.bat broken on other systems |
tags: | added: installer patch-needswork |
tags: | added: check-for-breezy |
Well, actually 'script_path' was generated on the build machine .. but script_path will vary on the user's machine. So this may not be reproduced when you actually do "python setup.py install --root=i" ... nevertheless, this patch makes bzr.bat static ... therefore my_install_scripts can be removed from setup.py (less code == good).