[py-svn] r57502 - py/build
hpk at codespeak.net
hpk at codespeak.net
Wed Aug 20 14:39:14 CEST 2008
Author: hpk
Date: Wed Aug 20 14:39:13 2008
New Revision: 57502
Modified:
py/build/gensetup.py
py/build/makebdistegg.py
py/build/winpathclean.py
Log:
snapshot of build scripts.
Modified: py/build/gensetup.py
==============================================================================
--- py/build/gensetup.py (original)
+++ py/build/gensetup.py Wed Aug 20 14:39:13 2008
@@ -105,10 +105,10 @@
author_email=%(author_email)r,
ext_modules = [Extension("py.c-extension.greenlet.greenlet",
["py/c-extension/greenlet/greenlet.c"]),],
- scripts = getscripts(),
''' % params)
indent = " " * 8
self.append_pprint(indent, py_modules=['_findpy',]),
+ self.append_pprint(indent, scripts=self.getscripts())
self.append_pprint(indent, long_description=params['long_description'])
self.append_pprint(indent, classifiers=self.meta.classifiers)
self.append_pprint(indent, packages=self.getpackages())
@@ -121,6 +121,8 @@
self.lines.append(indent[4:] + ")\n")
def setup_scripts(self):
+ # XXX this was used for a different approach
+ not used
self.append("""
def getscripts():
if sys.platform == "win32":
@@ -148,7 +150,7 @@
self.lines.append(indent + line.rstrip())
self.lines[-1] = self.lines[-1] + ","
- def xxxgetscripts(self):
+ def getscripts(self):
bindir = self.wcbasedir.join('py', 'bin')
scripts = []
for p in self.allpaths:
@@ -183,7 +185,7 @@
datafiles.append(p.relto(self.wcbasedir))
return datafiles
- def xxxsetup_win32(self):
+ def setup_win32(self):
import winpath
self.append(py.std.inspect.getsource(winpath))
self.append("""
@@ -197,8 +199,8 @@
def setup_win32(self):
self.append(r'''
- # if this is an sdist install we might have the unix
- # scripts and need to replace them with windows ones.
+ # scripts for windows: turn "py.SCRIPT" into "py_SCRIPT" and create
+ # "py.SCRIPT.cmd" files invoking "py_SCRIPT"
from distutils.command.install_scripts import install_scripts
class my_install_scripts(install_scripts):
def run(self):
@@ -207,18 +209,17 @@
for fn in self.outfiles:
basename = os.path.basename(fn)
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):
- os.remove(p)
- newname = fn + ".cmd"
- if os.path.exists(newname):
- os.remove(newname)
- f = open(newname, 'w')
+ newbasename = basename.replace(".", "_")
+ newfn = os.path.join(os.path.dirname(fn), newbasename)
+ if os.path.exists(newfn):
+ os.remove(newfn)
+ os.rename(fn, newfn)
+ fncmd = fn + ".cmd"
+ if os.path.exists(fncmd):
+ os.remove(fncmd)
+ f = open(fncmd, 'w')
f.write("@echo off\n")
- name = "py" + basename[3:]
- f.write('python -c "from _findpy import py; py.cmdline.%s()"' % name)
+ f.write('python "%%~dp0\%s" %%*' %(newbasename))
f.close()
if sys.platform == "win32":
cmdclass = {'install_scripts': my_install_scripts}
@@ -229,7 +230,7 @@
def write_setup(self):
self.setup_header()
self.setup_function()
- self.setup_scripts()
+ #self.setup_scripts()
self.setup_win32()
self.setup_trailer()
targetfile = self.basedir.join("setup.py")
Modified: py/build/makebdistegg.py
==============================================================================
--- py/build/makebdistegg.py (original)
+++ py/build/makebdistegg.py Wed Aug 20 14:39:13 2008
@@ -63,7 +63,7 @@
log = channel.receive()
logpath = py.path.local("bdist_egg_%s.log" % python)
logpath.write(log)
- trace("received result in", logpath)
+ trace("received log file in", logpath)
def remote_getdist():
channel = winexec(r"""
@@ -79,7 +79,7 @@
break
print "receiving", basename
content = channel.receive()
- py.path.local(basename).write(content)
+ py.path.local("dist").ensure(basename).write(content)
print "complete"
def winexec(source):
Modified: py/build/winpathclean.py
==============================================================================
--- py/build/winpathclean.py (original)
+++ py/build/winpathclean.py Wed Aug 20 14:39:13 2008
@@ -69,9 +69,7 @@
self._winreg.SetValueEx(k, value_name, 0, value_type, value)
self._winreg.CloseKey(k)
-if __name__ == "__main__":
- w32path = Win32PathHandling()
- w32path.remove_pylib_path()
+def remove_scripts():
sitepackages = py.path.local(sysconfig.get_python_lib())
scripts = sitepackages.dirpath().dirpath().join("scripts")
if not scripts.check():
@@ -79,12 +77,17 @@
raise SystemExit, 1
for name in ("py.test", "py.lookup", "py.cleanup", "py.rest",
"py.which", "py.countloc", '_update_website.py',
- '_makepyrelease.py', 'pytest.cmd',):
+ '_makepyrelease.py', '_findpy.py', 'pytest.cmd',):
p = scripts.join(name)
if p.check():
print "removing", p
p.remove()
- p = scripts.join(name.replace(".", "_"))
- if p.check():
- print "removing", p
- p.remove()
+ #p = scripts.join(name.replace(".", "_"))
+ #if p.check():
+ # print "removing", p
+ # p.remove()
+
+if __name__ == "__main__":
+ w32path = Win32PathHandling()
+ w32path.remove_pylib_path()
+ remove_scripts()
More information about the pytest-commit
mailing list