[py-svn] r57351 - in py/release/0.9.x: . py/bin/win32
hpk at codespeak.net
hpk at codespeak.net
Sun Aug 17 15:00:24 CEST 2008
Author: hpk
Date: Sun Aug 17 15:00:23 2008
New Revision: 57351
Removed:
py/release/0.9.x/py/bin/win32/
Modified:
py/release/0.9.x/setup.py
Log:
new approach for getting executable win32 scripts
Modified: py/release/0.9.x/setup.py
==============================================================================
--- py/release/0.9.x/setup.py (original)
+++ py/release/0.9.x/setup.py Sun Aug 17 15:00:23 2008
@@ -1,9 +1,9 @@
"""
setup file for 'py' package based on:
- svn+ssh://codespeak.net/svn/py/release/0.9.x, revision=57343
+ svn+ssh://codespeak.net/svn/py/release/0.9.x, revision=57348
- [auto-generated by gensetup.py, Sun Aug 17 14:05:21 2008 CET]
+ autogenerated by gensetup.py, 57350, Sun Aug 17 15:00:37 2008 CET
"""
import os, sys
from distutils.core import setup, Extension
@@ -22,7 +22,8 @@
ext_modules = [Extension("py.c-extension.greenlet.greenlet",
["py/c-extension/greenlet/greenlet.c"]),],
- scripts=['py/bin/py.cleanup',
+ scripts=['py/bin/_findpy.py',
+ 'py/bin/py.cleanup',
'py/bin/py.countloc',
'py/bin/py.lookup',
'py/bin/py.rest',
@@ -96,11 +97,6 @@
'bin/py.rest',
'bin/py.test',
'bin/pytest.cmd',
- 'bin/win32/py.cleanup.cmd',
- 'bin/win32/py.countloc.cmd',
- 'bin/win32/py.lookup.cmd',
- 'bin/win32/py.rest.cmd',
- 'bin/win32/py.test.cmd',
'c-extension/greenlet/README.txt',
'c-extension/greenlet/greenlet.c',
'c-extension/greenlet/greenlet.h',
@@ -162,66 +158,7 @@
'test/rsession/webdata/source.js']},
)
-#
-# some helpers to add the py lib scripts to the
-# WIN32 cmdline environment
-#
-import os, sys
-try:
- import _winreg
-except ImportError:
- winextensions = 0
-else:
- winextensions = 1
-
-def on_win32_add_to_PATH():
- if sys.platform != 'win32' or not winextensions:
- return
- assert 0
- # Add py/bin to PATH environment variable
- bindir = os.path.join(sysconfig.get_python_lib(), "py", "bin", "win32")
- reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
- key = r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
- path = get_registry_value(reg, key, "Path")
- if bindir in path:
- return
- path = bindir + ";" + path
- print "Setting PATH to:", path
- set_registry_value(reg, key, "Path", path)
- #print "Current PATH is:", get_registry_value(reg, key, "Path")
-
- # Propagate changes to current command prompt
- os.system("set PATH=%s" % path)
- try_propagate_system()
-
-def try_propagate_system():
- try:
- import win32gui, win32con
- except ImportError:
- return
- # Propagate changes throughout the system
- win32gui.SendMessageTimeout(win32con.HWND_BROADCAST,
- win32con.WM_SETTINGCHANGE, 0, "Environment",
- win32con.SMTO_ABORTIFHUNG, 5000)
-
-
-
-def get_registry_value(reg, key, value_name):
- k = _winreg.OpenKey(reg, key)
- value = _winreg.QueryValueEx(k, value_name)[0]
- _winreg.CloseKey(k)
- return value
-
-def set_registry_value(reg, key, value_name, value):
- k = _winreg.OpenKey(reg, key, 0, _winreg.KEY_WRITE)
- value_type = _winreg.REG_SZ
- # if we handle the Path value, then set its type to REG_EXPAND_SZ
- # so that things like %SystemRoot% get automatically expanded by the
- # command prompt
- if value_name == "Path":
- value_type = _winreg.REG_EXPAND_SZ
- _winreg.SetValueEx(k, value_name, 0, value_type, value)
- _winreg.CloseKey(k)
+# on windows we need to hack up the to-be-installed scripts
from distutils.command.install_scripts import install_scripts
class my_install_scripts(install_scripts):
@@ -245,9 +182,8 @@
f.write('python "~dp0\%s" %%*\n' % basename)
f.close()
-
cmdclass = {'install_scripts': my_install_scripts}
-
+
if __name__ == '__main__':
main()
-
+
\ No newline at end of file
More information about the pytest-commit
mailing list