[py-svn] r57483 - in py/release/0.9.x: . py

hpk at codespeak.net hpk at codespeak.net
Wed Aug 20 00:22:47 CEST 2008


Author: hpk
Date: Wed Aug 20 00:22:45 2008
New Revision: 57483

Modified:
   py/release/0.9.x/MANIFEST
   py/release/0.9.x/py/__init__.py
   py/release/0.9.x/setup.py
Log:
another try at a clean install of scripts


Modified: py/release/0.9.x/MANIFEST
==============================================================================
--- py/release/0.9.x/MANIFEST	(original)
+++ py/release/0.9.x/MANIFEST	Wed Aug 20 00:22:45 2008
@@ -63,11 +63,17 @@
 py/apigen/tracer/tracer.py
 py/bin/_docgen.py
 py/bin/_findpy.py
+py/bin/_genscripts.py
 py/bin/py.cleanup
 py/bin/py.countloc
 py/bin/py.lookup
 py/bin/py.rest
 py/bin/py.test
+py/bin/win/py.cleanup.cmd
+py/bin/win/py.countloc.cmd
+py/bin/win/py.lookup.cmd
+py/bin/win/py.rest.cmd
+py/bin/win/py.test.cmd
 py/builtin/__init__.py
 py/builtin/enumerate.py
 py/builtin/exception.py
@@ -98,6 +104,13 @@
 py/c-extension/greenlet/test_greenlet.py
 py/c-extension/greenlet/test_remote.py
 py/c-extension/greenlet/test_throw.py
+py/cmdline/__init__.py
+py/cmdline/pycleanup.py
+py/cmdline/pycountloc.py
+py/cmdline/pylookup.py
+py/cmdline/pyrest.py
+py/cmdline/pytest.py
+py/cmdline/testing/test_generic.py
 py/code/__init__.py
 py/code/code.py
 py/code/excinfo.py

Modified: py/release/0.9.x/py/__init__.py
==============================================================================
--- py/release/0.9.x/py/__init__.py	(original)
+++ py/release/0.9.x/py/__init__.py	Wed Aug 20 00:22:45 2008
@@ -7,7 +7,7 @@
 """
 from initpkg import initpkg
 
-version = "0.9.2-alpha-8"
+version = "0.9.2a9"
 
 initpkg(__name__,
     description = "py lib: agile development and test support library",

Modified: py/release/0.9.x/setup.py
==============================================================================
--- py/release/0.9.x/setup.py	(original)
+++ py/release/0.9.x/setup.py	Wed Aug 20 00:22:45 2008
@@ -18,7 +18,7 @@
     setup(cmdclass=cmdclass,
         name='py',
         description='py lib: agile development and test support library',
-        version='0.9.2-alpha-8', 
+        version='0.9.2a9', 
         url='http://pylib.org', 
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], 
@@ -26,6 +26,7 @@
         author_email='holger at merlinux.eu, py-dev at codespeak.net',
         ext_modules = [Extension("py.c-extension.greenlet.greenlet", 
             ["py/c-extension/greenlet/greenlet.c"]),],
+        scripts = getscripts(),
         
         py_modules=['_findpy'],
         long_description='the py lib is a development support library featuring py.test, ad-hoc distributed execution, micro-threads and svn abstractions.',
@@ -40,11 +41,6 @@
                      'Topic :: System :: Distributed Computing',
                      'Topic :: Utilities',
                      'Programming Language :: Python'],
-        scripts=['py/bin/py.cleanup',
-                 'py/bin/py.countloc',
-                 'py/bin/py.lookup',
-                 'py/bin/py.rest',
-                 'py/bin/py.test'],
         packages=['py',
                   'py.apigen',
                   'py.apigen.rest',
@@ -59,6 +55,7 @@
                   'py.apigen.tracer.testing.package.submodule.pak',
                   'py.builtin',
                   'py.builtin.testing',
+                  'py.cmdline',
                   'py.code',
                   'py.code.testing',
                   'py.compat',
@@ -110,11 +107,17 @@
                              'apigen/todo.txt',
                              'bin/_docgen.py',
                              'bin/_findpy.py',
+                             'bin/_genscripts.py',
                              'bin/py.cleanup',
                              'bin/py.countloc',
                              'bin/py.lookup',
                              'bin/py.rest',
                              'bin/py.test',
+                             'bin/win/py.cleanup.cmd',
+                             'bin/win/py.countloc.cmd',
+                             'bin/win/py.lookup.cmd',
+                             'bin/win/py.rest.cmd',
+                             'bin/win/py.test.cmd',
                              'c-extension/greenlet/README.txt',
                              'c-extension/greenlet/dummy_greenlet.py',
                              'c-extension/greenlet/greenlet.c',
@@ -133,6 +136,7 @@
                              'c-extension/greenlet/test_greenlet.py',
                              'c-extension/greenlet/test_remote.py',
                              'c-extension/greenlet/test_throw.py',
+                             'cmdline/testing/test_generic.py',
                              'compat/LICENSE',
                              'compat/testing/test_doctest.txt',
                              'compat/testing/test_doctest2.txt',
@@ -190,71 +194,19 @@
         zip_safe=False,
     )
 
-class Win32PathHandling:
-    """ a helper to remove things added to system PATHs in previous installations. """
-    _winreg = None
-    def __init__(self):
-        if sys.platform == 'win32':
-            try:
-                import _winreg  
-            except ImportError:
-                print sys.stderr, "huh could not import _winreg on windows, ignoring"
-            else:
-                self._winreg = _winreg
-
-    def remove_pylib_path(self):
-        reg = self._winreg.ConnectRegistry(
-		  None, self._winreg.HKEY_LOCAL_MACHINE)
-        key = r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
-        path = self.get_registry_value(reg, key, "Path")
-        newpath = self.prunepath(path)
-        if newpath != path:
-            print "PATH contains old py/bin/win32 scripts:", path
-            print "pruning and setting a new PATH:", newpath
-            self.set_registry_value(reg, key, "Path", newpath)
-        # Propagate changes to current command prompt
-        os.system("set PATH=%s" % path)
-        self.try_propagate_system()
-
-    def prunepath(self, path):
-        basename = os.path.basename
-        dirname = os.path.dirname
-        l = []
-        for p in path.split(';'):
-            if basename(p) == "win32" and basename(dirname(p)) == "bin" \
-               and basename(dirname(dirname(p))) == "py":
-               continue # prune this path 
-            l.append(p)
-        return ";".join(l)
-
-    def try_propagate_system(self):
-        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(self, reg, key, value_name):
-        k = self._winreg.OpenKey(reg, key)
-        value = self._winreg.QueryValueEx(k, value_name)[0]
-        self._winreg.CloseKey(k)
-        return value
-      
-    def set_registry_value(self, reg, key, value_name, value):
-        k = self._winreg.OpenKey(reg, key, 0, self._winreg.KEY_WRITE)
-        value_type = self._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 = self._winreg.REG_EXPAND_SZ
-        self._winreg.SetValueEx(k, value_name, 0, value_type, value)
-        self._winreg.CloseKey(k)
-
-# on windows we need to hack up the to-be-installed scripts
+def getscripts():
+    if sys.platform == "win32":
+        base = "py/bin/win32/"
+        ext = ".cmd"
+    else:
+        base = "py/bin/"
+        ext = ""
+    l = []
+    for name in ['py.rest', 'py.countloc', 'py.lookup', 'py.test', 'py.cleanup']:
+        l.append(base + name + ext)
+        
+# if this is an sdist install we might have the unix
+# scripts and need to replace them with windows ones. 
 from distutils.command.install_scripts import install_scripts
 class my_install_scripts(install_scripts):
     def run(self):
@@ -262,23 +214,20 @@
         #print self.outfiles
         for fn in self.outfiles:
             basename = os.path.basename(fn)
-            if "." in basename:
-                #print "tackling", fn
-                newbasename = basename.replace(".", "_")
-                newfn = os.path.join(os.path.dirname(fn), newbasename)
-                if os.path.exists(newfn):
-                    os.remove(newfn)
-                os.rename(fn, newfn)
+            if basename.startswith("py.") and not basename.endswith(".cmd"):
+                os.remove(fn)  
+                # also remove paths from intermediate alpha versions 
+                p = os.path.join(os.path.dirname(fn), basename.replace(".", "_"))
+                if os.path.exists(p):
+                    p.remove()
                 newname = fn + ".cmd"
                 if os.path.exists(newname):
                    os.remove(newname)
                 f = open(newname, 'w')
                 f.write("@echo off\n")
-                f.write('python "%%~dp0\%s" %%*\n' % newbasename)
+                name = "py" + basename[3:] 
+                f.write('python -c "from _findpy import py; py.cmdline.%s"' % name)
                 f.close()
-        w32path = Win32PathHandling()
-        w32path.remove_pylib_path()
-                
 if sys.platform == "win32":
     cmdclass = {'install_scripts': my_install_scripts}
 else:



More information about the pytest-commit mailing list