pyd / SConstruct

from os.path import join
import re, sys
rx = re.compile("(\d+)\.(\d+)")

def pv_split(pyversion):
    m = rx.match(pyversion)
    maj = int(;
    min = int(;
    assert maj in [2,3], "invalid python version: %s" % pyversion
    if maj == 2: assert min in range(4,8), "invalid python version: %s" % pyversion
    if maj == 3: assert False, "python 3000 not supported"
    if maj == 3: assert min in range(0,3), "invalid python version: %s" % pyversion
    return maj,min

def py_versions(pyversion):
    maj, min = pv_split(pyversion)
    return ["Python_%s_%s_Or_Later" % (maj, min_) for min_ in range(4, min+1)]

def py_lib(pyversion):
    return ["-L-lpython"+pyversion]

infra = "#infrastructure"
pydfiles =  (Glob(join(infra,"meta","*.d"))   +
            Glob(join(infra,"util","*.d"))    +
            Glob(join(infra,"pyd","*.d"))     +

env27 = Environment(
    DPATH = [infra, join(infra, "python")],
    DVERSIONS = py_versions("2.7"),
    DFLAGS = ['-unittest', '-property', '-debug', '-gc'],
    DLINKFLAGS = py_lib("2.7"),
if sys.platform.lower().startswith("win"): exe_suffix = ".exe"
else: exe_suffix = ".x"
Export('infra', 'py_versions', 'py_lib', 'pydfiles', 'join', 'env27', "exe_suffix")
    join("examples", "pyd_unittests","SConscript"),
    join("infrastructure", "SConscript"),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.