summaryrefslogtreecommitdiffstats
path: root/patches/Python-2.6.2/generic/0012-distutils-introduce-and-use-EXECUTABLE_DIRNAME.patch
blob: 601aa952b8d8954ede211c75599bc4be129f3bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 35b2f370694bb610118064ef0a6cc5a30fad4b70 Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Tue, 28 Apr 2009 18:05:33 +0200
Subject: [PATCH] distutils: introduce and use EXECUTABLE_DIRNAME

os.path.abspath(sys.executable) is used several times in
distutils.sysconfig. This patch introduces the variable
EXECUTABLE_DIRNAME which holds this information.

This makes it easier to overwrite this value in the cross compilation
scenario. (see later patch)

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 Lib/distutils/sysconfig.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 99c0e63..a00b2f9 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -21,11 +21,12 @@ from distutils.errors import DistutilsPlatformError
 # These are needed in a couple of spots, so just compute them once.
 PREFIX = os.path.normpath(sys.prefix)
 EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+EXECUTABLE_DIRNAME = os.path.dirname(os.path.abspath(sys.executable))
 
 # Path to the base directory of the project. On Windows the binary may
 # live in project/PCBuild9.  If we're dealing with an x64 Windows build,
 # it'll live in project/PCbuild/amd64.
-project_base = os.path.dirname(os.path.abspath(sys.executable))
+project_base = EXECUTABLE_DIRNAME
 if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
     project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
 # PC/VS7.1
@@ -73,13 +74,12 @@ def get_python_inc(plat_specific=0, prefix=None):
         prefix = plat_specific and EXEC_PREFIX or PREFIX
     if os.name == "posix":
         if python_build:
-            base = os.path.dirname(os.path.abspath(sys.executable))
             if plat_specific:
-                inc_dir = base
+                inc_dir = EXECUTABLE_DIRNAME
             else:
-                inc_dir = os.path.join(base, "Include")
+                inc_dir = os.path.join(EXECUTABLE_DIRNAME, "Include")
                 if not os.path.exists(inc_dir):
-                    inc_dir = os.path.join(os.path.dirname(base), "Include")
+                    inc_dir = os.path.join(os.path.dirname(EXECUTABLE_DIRNAME), "Include")
             return inc_dir
         return os.path.join(prefix, "include", "python" + get_python_version())
     elif os.name == "nt":
@@ -218,7 +218,7 @@ def get_config_h_filename():
 def get_makefile_filename():
     """Return full pathname of installed Makefile from the Python build."""
     if python_build:
-        return os.path.join(os.path.dirname(sys.executable), "Makefile")
+        return os.path.join(EXECUTABLE_DIRNAME, "Makefile")
     lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
     return os.path.join(lib_dir, "config", "Makefile")
 
-- 
1.5.6.3