cpython: f70c16189876 (original) (raw)

Mercurial > cpython

changeset 93904:f70c16189876

#22980 Adds platform and version tags to .pyd files [#22980]

Steve Dower steve.dower@microsoft.com
date Mon, 15 Dec 2014 20:45:23 -0800
parents e91bc3e5eb22
children cdc3837cb1fc
files Lib/test/test_importlib/test_windows.py Misc/NEWS PC/pyconfig.h PCbuild/python.props Python/dynload_win.c
diffstat 5 files changed, 54 insertions(+), 6 deletions(-)[+] [-] Lib/test/test_importlib/test_windows.py 24 Misc/NEWS 3 PC/pyconfig.h 4 PCbuild/python.props 4 Python/dynload_win.c 25

line wrap: on

line diff

--- a/Lib/test/test_importlib/test_windows.py +++ b/Lib/test/test_importlib/test_windows.py @@ -2,9 +2,11 @@ from . import util as test_util machinery = test_util.import_importlib('importlib.machinery') import os +import re import sys import unittest from test import support +from distutils.util import get_platform from contextlib import contextmanager from .util import temp_module @@ -83,3 +85,25 @@ class WindowsRegistryFinderTests: (Frozen_WindowsRegistryFinderTests, Source_WindowsRegistryFinderTests ) = test_util.test_both(WindowsRegistryFinderTests, machinery=machinery) + +@unittest.skipUnless(sys.platform.startswith('win'), 'requires Windows') +class WindowsExtensionSuffixTests:

+

+

+ +(Frozen_WindowsExtensionSuffixTests,

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -1584,6 +1584,9 @@ Windows

--- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -145,9 +145,11 @@ WIN32 is still required for the locale m #if defined(_M_IA64) #define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)") #define MS_WINI64 +#define PYD_PLATFORM_TAG "win_ia64" #elif defined(_M_X64) || defined(_M_AMD64) #define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") #define MS_WINX64 +#define PYD_PLATFORM_TAG "win_amd64" #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") #endif @@ -193,8 +195,10 @@ typedef _W64 int ssize_t; #if defined(MS_WIN32) && !defined(MS_WIN64) #if defined(_M_IX86) #define COMPILER _Py_PASTE_VERSION("32 bit (Intel)") +#define PYD_PLATFORM_TAG "win32" #elif defined(_M_ARM) #define COMPILER _Py_PASTE_VERSION("32 bit (ARM)") +#define PYD_PLATFORM_TAG "win_arm" #else #define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)") #endif

--- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -96,6 +96,10 @@ python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt) +

--- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -9,6 +9,7 @@ #include <ctype.h> #include "importdl.h" +#include "patchlevel.h" #include <windows.h> // "activation context" magic - see dl_nt.c... @@ -17,16 +18,28 @@ extern ULONG_PTR _Py_ActivateActCtx(); void _Py_DeactivateActCtx(ULONG_PTR cookie); #endif +#ifdef _DEBUG +#define PYD_DEBUG_SUFFIX "_d" +#else +#define PYD_DEBUG_SUFFIX "" +#endif + +#define STRINGIZE2(x) #x +#define STRINGIZE(x) STRINGIZE2(x) +#ifdef PYD_PLATFORM_TAG +#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" STRINGIZE(PY_MAJOR_VERSION) STRINGIZE(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd" +#else +#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" STRINGIZE(PY_MAJOR_VERSION) STRINGIZE(PY_MINOR_VERSION) ".pyd" +#endif + +#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd" + const char *_PyImport_DynLoadFiletab[] = { -#ifdef _DEBUG

-#else

-#endif