[pypy-svn] r75555 - in pypy/branch/sys-prefix/lib-python: . modified-2.5.2/distutils modified-2.5.2/distutils/command modified-2.5.2/distutils/tests
antocuni at codespeak.net
antocuni at codespeak.net
Thu Jun 24 12:07:55 CEST 2010
Author: antocuni
Date: Thu Jun 24 12:07:54 2010
New Revision: 75555
Added:
pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/tests/test_msvccompiler.py
- copied unchanged from r75554, pypy/trunk/lib-python/modified-2.5.2/distutils/tests/test_msvccompiler.py
Modified:
pypy/branch/sys-prefix/lib-python/ (props changed)
pypy/branch/sys-prefix/lib-python/conftest.py
pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/command/build_ext.py
pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/msvccompiler.py
pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
Log:
merge from trunk -r74817:HEAD
------------------------------------------------------------------------
r75092 | hpk | 2010-06-04 01:18:53 +0200 (Fri, 04 Jun 2010) | 2 lines
fix collection of lib-python tests under py.py
------------------------------------------------------------------------
r75098 | arigo | 2010-06-04 11:13:54 +0200 (Fri, 04 Jun 2010) | 5 lines
Revert r75092. It causes massive failures of the nightly applevel tests.
I think (by running pypy-c py.test --collect) that it is because in this
case it causes py.test to try to collect far more stuff, including both
the 2.5.2/test and the modified-2.5.2/test version of the same test.
------------------------------------------------------------------------
r75113 | hpk | 2010-06-04 17:45:17 +0200 (Fri, 04 Jun 2010) | 14 lines
try to redo the fix related to testing in lib-python.
Tests are now collected more "normally" in their respective
directories 2.5.2/test and modified-2.5.2/test instead of "faking"
an artifical tree at lib-python level.
Note that you will get a collection error if you run a specific test via
"py.ttest lib-python/2.5.2/test/test_XYZ.py" if there is a test_XYZ in
the modified-2.5.2 directory.
Running "py.test lib-python" or "py.test --pypy=pypy-c lib-python" will
run both modified and unmodified tests as is to be expected and filenames
during testing progress clearly indicate where a test comes from.
------------------------------------------------------------------------
r75195 | afa | 2010-06-08 16:04:01 +0200 (Tue, 08 Jun 2010) | 2 lines
Revert part of the change, and use the same name as CPython for the import library
------------------------------------------------------------------------
r75196 | afa | 2010-06-08 16:31:42 +0200 (Tue, 08 Jun 2010) | 5 lines
On Windows, correctly retrieve the version of the compiler used to compile the interpreter.
Don't rely on sys.version (pypy does not indicates the compiler version),
directly fetch the manifest embedded in the program.
------------------------------------------------------------------------
r75234 | arigo | 2010-06-09 12:16:02 +0200 (Wed, 09 Jun 2010) | 2 lines
Attempt to skip this file on non-Windows platforms.
------------------------------------------------------------------------
r75476 | fijal | 2010-06-20 07:39:42 +0200 (Sun, 20 Jun 2010) | 2 lines
Look also into pypy_prefix/include, hopefully a short living hack.
------------------------------------------------------------------------
Modified: pypy/branch/sys-prefix/lib-python/conftest.py
==============================================================================
--- pypy/branch/sys-prefix/lib-python/conftest.py (original)
+++ pypy/branch/sys-prefix/lib-python/conftest.py Thu Jun 24 12:07:54 2010
@@ -520,11 +520,14 @@
return cache.get(name, None)
def collect(self):
+ we_are_in_modified = self.fspath == modregrtestdir
l = []
- for x in testmap:
+ for x in self.fspath.listdir():
name = x.basename
regrtest = self.get(name)
- if regrtest is not None:
+ if regrtest is not None:
+ if bool(we_are_in_modified) ^ regrtest.ismodified():
+ continue
#if option.extracttests:
# l.append(InterceptedRunModule(name, self, regrtest))
#else:
@@ -532,7 +535,14 @@
return l
def pytest_collect_directory(parent, path):
- return RegrDirectory(path, parent)
+ # use RegrDirectory collector for both modified and unmodified tests
+ if path in (modregrtestdir, regrtestdir):
+ return RegrDirectory(path, parent)
+
+def pytest_ignore_collect(path):
+ # ignore all files - only RegrDirectory generates tests in lib-python
+ if path.check(file=1):
+ return True
class RunFileExternal(py.test.collect.File):
def __init__(self, name, parent, regrtest):
Modified: pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/command/build_ext.py
==============================================================================
--- pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/command/build_ext.py (original)
+++ pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/command/build_ext.py Thu Jun 24 12:07:54 2010
@@ -647,7 +647,9 @@
"""
# The python library is always needed on Windows.
if sys.platform == "win32":
- pythonlib = 'libpypy-c.exe'
+ template = "python%d%d"
+ pythonlib = (template %
+ (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
# don't extend ext.libraries, it may be shared with other
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
Modified: pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/msvccompiler.py
==============================================================================
--- pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/msvccompiler.py (original)
+++ pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/msvccompiler.py Thu Jun 24 12:07:54 2010
@@ -159,14 +159,60 @@
s = s.replace(k, v)
return s
+def get_manifests():
+ """Retrieves the manifest(s) embedded in the current executable"""
+ import ctypes.wintypes
+ EnumResourceNames = ctypes.windll.kernel32.EnumResourceNamesA
+ EnumResourceNameCallback = ctypes.WINFUNCTYPE(
+ ctypes.wintypes.BOOL,
+ ctypes.wintypes.HMODULE, ctypes.wintypes.LONG,
+ ctypes.wintypes.LONG, ctypes.wintypes.LONG)
+ FindResource = ctypes.windll.kernel32.FindResourceA
+ LoadResource = ctypes.windll.kernel32.LoadResource
+ FreeResource = ctypes.windll.kernel32.FreeResource
+ SizeofResource = ctypes.windll.kernel32.SizeofResource
+ LockResource = ctypes.windll.kernel32.LockResource
+ UnlockResource = lambda x: None # hehe
+
+ manifests = []
+
+ def callback(hModule, lpType, lpName, lParam):
+ hResource = FindResource(hModule, lpName, lpType)
+ size = SizeofResource(hModule, hResource)
+ hData = LoadResource(hModule, hResource)
+ try:
+ ptr = LockResource(hData)
+ try:
+ manifests.append(ctypes.string_at(ptr, size))
+ finally:
+ UnlockResource(hData)
+ finally:
+ FreeResource(hData)
+ return True
+
+ hModule = None # main executable
+ RT_MANIFEST = 24 # from WinUser.h
+ EnumResourceNames(hModule, RT_MANIFEST,
+ EnumResourceNameCallback(callback), None)
+ return manifests
+
def get_build_version():
"""Return the version of MSVC that was used to build Python.
-
- For Python 2.3 and up, the version number is included in
- sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
+ try:
+ manifests = get_manifests()
+ for manifest in manifests:
+ match = re.search('"Microsoft.VC([0-9]+).CRT"', manifest)
+ if match:
+ return int(match.group(1)) / 10.0
+ except BaseException:
+ pass
+ # No manifest embedded, use default compiler version
return 9.0
+def get_build_architecture():
+ return 'Intel'
+
def normalize_and_reduce_paths(paths):
"""Return a list of normalized paths with duplicates removed.
Modified: pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
==============================================================================
--- pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py (original)
+++ pypy/branch/sys-prefix/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py Thu Jun 24 12:07:54 2010
@@ -13,6 +13,9 @@
def get_python_inc(plat_specific=0, prefix=None):
from os.path import join as j
+ cand = j(sys.pypy_prefix, 'include')
+ if os.path.exists(cand):
+ return cand
if plat_specific:
return j(sys.prefix, "pypy", "_interfaces")
return j(sys.prefix, 'pypy', 'module', 'cpyext', 'include')
More information about the Pypy-commit
mailing list