|
1 | | -"""Configure SCons, CxxTest and the conda environment for CI tests.""" |
| 1 | +"""Write the conda environment file for the CI tests.""" |
2 | 2 |
|
3 | 3 | import json |
4 | 4 | from pathlib import Path |
|
7 | 7 | for filename in ("build.txt", "conda.txt", "tests.txt"): |
8 | 8 | for line in (Path("requirements") / filename).read_text().splitlines(): |
9 | 9 | spec = line.split("#", 1)[0].strip() |
10 | | - if spec and spec != "cxxtest": |
| 10 | + if spec: |
11 | 11 | requirements.append(spec) |
12 | 12 |
|
13 | 13 | Path("build").mkdir(exist_ok=True) |
|
22 | 22 | ) |
23 | 23 | + "\n" |
24 | 24 | ) |
25 | | - |
26 | | -Path("sconscript.local").write_text("""\ |
27 | | -Import('env') |
28 | | -import os |
29 | | -import sys |
30 | | -
|
31 | | -prefix = os.environ['CONDA_PREFIX'] |
32 | | -cxxtest = Dir('#/build/cxxtest').abspath |
33 | | -env.Replace(CXXTEST=os.path.join(cxxtest, 'bin', 'cxxtestgen'), |
34 | | - CXXTEST_INSTALL_DIR=cxxtest, CXXTEST_PYTHON=sys.executable) |
35 | | -
|
36 | | -if env['PLATFORM'] == 'win32': |
37 | | - from SCons.Platform.win32 import exec_spawn |
38 | | -
|
39 | | - # The outer CI shell already activates conda and SCons configures MSVC. |
40 | | - # /D stops each compiler/test-generator child from repeating cmd AutoRun. |
41 | | - def spawn_without_autorun(sh, escape, cmd, args, child_env): |
42 | | - return exec_spawn([sh, '/D', '/C', escape(' '.join(args))], child_env) |
43 | | -
|
44 | | - env['SPAWN'] = spawn_without_autorun |
45 | | -else: |
46 | | - env.Replace(CXX=os.environ.get('CXX', os.path.join(prefix, 'bin', 'c++'))) |
47 | | - env.Prepend(CCFLAGS=['-isystem' + os.path.join(prefix, 'include')]) |
48 | | - env.Append(LIBPATH=os.path.join(prefix, 'lib')) |
49 | | - env.Append(LINKFLAGS='-Wl,-rpath,' + os.path.join(prefix, 'lib')) |
50 | | - if env['PLATFORM'] == 'darwin': |
51 | | - sdk = os.environ.get('CONDA_BUILD_SYSROOT') |
52 | | - if sdk: |
53 | | - env.Append(CXXFLAGS=['-isysroot', sdk]) |
54 | | - env.Append(LINKFLAGS=['-isysroot', sdk]) |
55 | | -""") |
0 commit comments