Commits

Matthew Moses committed ac0f95a

Fix an issue which prevented linking with Python 3.

The Python 3 path was being set as though extended interpolation were being
used to read the configuration file. However, this is not the case. Update the
build script to treat each configuration value as a format string and provide
a reference to the build context. This allows the Python 3 path to be properly
configured.

Also update the Windows 7 SDK path to be treated in a similar manner.

Comments (0)

Files changed (3)

-6dca6ae28194f122820114715fae7d51df96e275 vim
+34a3b852ec058ea7022952f8b42228d331182761 vim
 [DEFAULT]
+sdk_include_dir = {c.sdk_path}
 # Always disable debugging support.
 debug = no
 map = no
 sniff = no
 xpm = no
 # Python configuration. Only enable support for Python 3.3.
-python3 = ${python_path}
+python3 = {c.python_path}
 python3_ver = 33
 dynamic_python3 = yes
 # Common options to enable.
 import configparser
 import os.path
 import subprocess
+import sys
 import winreg
 
 
     def __init__(self):
         self.scriptdir = os.path.dirname(os.path.abspath(__file__))
         self.buildscript = os.path.join(self.scriptdir, 'build.cmd')
+        self.python_path = sys.base_prefix
         self.vimdir = os.path.join(self.scriptdir, 'vim')
         self.vimsrcdir = os.path.join(self.vimdir, 'src')
 
         subkey = r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A'
         with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, subkey) as key:
             sdk_path = winreg.QueryValueEx(key, 'InstallationFolder')[0]
-        sdk_path = os.path.join(sdk_path, 'Include')
-
-        self.config = configparser.ConfigParser()
-        self.config.read(os.path.join(self.scriptdir, 'build.cfg'))
-        self.config['DEFAULT']['sdk_include_dir'] = sdk_path
+        self.sdk_path = os.path.join(sdk_path, 'Include')
 
 
 def execute_build(name, section, context):
     print('Building {}...'.format(name))
     env = dict(os.environ)
     for k, v in section.items():
-        env[k.upper()] = v
+        env[k.upper()] = v.format(c=context)
 
     pargs = ['cmd', '/Q', '/C', context.buildscript]
     logpath = os.path.join(context.scriptdir, 'build-{}.log'.format(name))
 
 def main():
     context = Context()
-    for section_name, section in context.config.items():
-        if section_name == context.config.default_section:
+    config = configparser.ConfigParser()
+    config.read(os.path.join(context.scriptdir, 'build.cfg'))
+    for section_name, section in config.items():
+        if section_name == config.default_section:
             continue
         if not execute_build(section_name, section, context):
             return 1