Skip to content

Commit

Permalink
remove package_metadata setting; add more comments; fix sdist build c…
Browse files Browse the repository at this point in the history
…rash
  • Loading branch information
ShadowJonathan committed May 15, 2024
1 parent ce34b77 commit 68163ea
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Core/ClientSMLSWIG/Python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ requires = [
# and other python build/install frontends (such as pip itself).
#
# We use a forked version of enscons to add python 3.12 support.
"enscons @ git+https://github.com/ShadowJonathan/enscons-soar@544f39f",
"enscons @ git+https://github.com/ShadowJonathan/enscons-soar@7d6f4ca",

# Required sub-dependencies of enscons.
"toml>=0.1",
Expand Down
2 changes: 1 addition & 1 deletion Core/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ if not CheckSWIG(env):
print('SWIG not found. Will not define sml_* build targets. Install swig to build wrappers for other languages.')
else:
for x in 'Python Java Tcl CSharp'.split():
SConscript(os.path.join('ClientSMLSWIG', x, 'SConscript'))
SConscript(os.path.join('ClientSMLSWIG', x, 'SConscript'), must_exist=False)

if 'MSVSProject' in kernel_env['BUILDERS']:
vcproj = kernel_env.MSVSProject(
Expand Down
33 changes: 26 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ py_sources += [
env.Alias(SML_PYTHON_ALIAS + "_dev", py_sources)

if enscons_active:
env['PACKAGE_METADATA'] = enscons.get_pyproject(env)['project']
# Instead of giving an explicit tag, we tell enscons that we're not building a "pure" (python-only) library,
# and so we let it determine the wheel tag by itself.
env['ROOT_IS_PURELIB'] = False
Expand All @@ -431,22 +430,42 @@ if enscons_active:

env.WhlFile(source=whl)

sdist_sources = env.Glob("Core/*/SConscript") + env.Glob("build_support/*.py") + [
sdist_sources = [
# Add SCons related files
"SConstruct",
"Core/SConscript",
*env.Glob("Core/*/SConscript"),
"Core/ClientSMLSWIG/Python/SConscript",
"Core/ClientSMLSWIG/Python/README.md",

# Add SWIG files
*env.Glob("Core/ClientSMLSWIG/*.i"),
*env.Glob("Core/ClientSMLSWIG/Python/*.i"),

# Add build support files
*env.Glob("build_support/*.py"),

# Entire SVS source tree
"Core/SVS",
] + env.Glob("Core/ClientSMLSWIG/Python/*.i") + env.Glob("Core/ClientSMLSWIG/*.i")

# Misc files
"Core/ClientSMLSWIG/Python/README.md",
]

# Look for files under Core with the following file extensions, for up to 5 levels deep.
#
# We cannot just add the directories, as they will then start to include the .tar.gz file,
# which scons treats as a "target", creating a circular dependency.
SOURCE_EXTS = {"h", "c", "cpp", "hpp", "cxx"}
for i in range(0, 5):
for ext in {"h", "c", "cpp", "hpp", "cxx"}:
for ext in SOURCE_EXTS:
sdist_sources.extend(
env.Glob("Core/" + ("*/" * i) + "*." + ext)
)

env.SDist(source=sdist_sources,
pyproject=True,
env.SDist(
source=sdist_sources,
# We tell enscons to include a generated / corrected pyproject.toml into the source distribution
pyproject=True,
)

# We make sure that an editable (`pip install -e`) installation always properly installs
Expand Down

0 comments on commit 68163ea

Please sign in to comment.