From 6afa443027d4da8614241f52ad445cb7711f8673 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Sat, 11 May 2024 19:37:17 +0200 Subject: [PATCH 1/3] experimental sdist support --- .gitignore | 1 + SConstruct | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.gitignore b/.gitignore index e153dd690c..806efceb4d 100644 --- a/.gitignore +++ b/.gitignore @@ -508,6 +508,7 @@ wheelhouse/ # pip/enscons build output soar_sml/ +/pyproject.toml ### Soar ### out/ diff --git a/SConstruct b/SConstruct index f59e340eff..0e8a472072 100644 --- a/SConstruct +++ b/SConstruct @@ -431,6 +431,25 @@ if enscons_active: env.WhlFile(source=whl) + # env.FindSourceFiles(whl) + + sdist_sources = env.Glob("Core/*/SConscript") + env.Glob("build_support/*.py") + [ + "SConstruct", + "Core/SConscript", + "Core/ClientSMLSWIG/Python/SConscript", + "Core/ClientSMLSWIG/Python/README.md", + "Core/SVS", + ] + env.Glob("Core/ClientSMLSWIG/Python/*.i") + env.Glob("Core/ClientSMLSWIG/*.i") + + for i in range(0, 5): + for ext in {"h", "c", "cpp", "hpp", "cxx"}: + sdist_sources.extend( + env.Glob("Core/" + ("*/" * i) + "*." + ext) + ) + + env.SDist(source=sdist_sources, + pyproject=True, + ) + # We make sure that an editable (`pip install -e`) installation always properly installs # the files in the correct places. env.Depends("editable", py_sources) From ce34b779551243149e2bf4d9c24848baca224951 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Wed, 15 May 2024 20:36:42 +0200 Subject: [PATCH 2/3] Remove extra comment --- SConstruct | 1 - 1 file changed, 1 deletion(-) diff --git a/SConstruct b/SConstruct index 0e8a472072..498fc20f0d 100644 --- a/SConstruct +++ b/SConstruct @@ -431,7 +431,6 @@ if enscons_active: env.WhlFile(source=whl) - # env.FindSourceFiles(whl) + sdist_sources = env.Glob("Core/*/SConscript") + env.Glob("build_support/*.py") + [ "SConstruct", "Core/SConscript", From 68163ea49af7a850e8d76f9d3be0a24a62c33c97 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Wed, 15 May 2024 21:02:39 +0200 Subject: [PATCH 3/3] remove package_metadata setting; add more comments; fix sdist build crash --- Core/ClientSMLSWIG/Python/pyproject.toml | 2 +- Core/SConscript | 2 +- SConstruct | 33 +++++++++++++++++++----- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Core/ClientSMLSWIG/Python/pyproject.toml b/Core/ClientSMLSWIG/Python/pyproject.toml index e146b55a19..cc6b10f542 100644 --- a/Core/ClientSMLSWIG/Python/pyproject.toml +++ b/Core/ClientSMLSWIG/Python/pyproject.toml @@ -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", diff --git a/Core/SConscript b/Core/SConscript index 04eabaca4c..587ecba3d0 100644 --- a/Core/SConscript +++ b/Core/SConscript @@ -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( diff --git a/SConstruct b/SConstruct index 498fc20f0d..edd1f063b7 100644 --- a/SConstruct +++ b/SConstruct @@ -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 @@ -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