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/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 f59e340eff..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,6 +430,44 @@ if enscons_active: env.WhlFile(source=whl) + sdist_sources = [ + # Add SCons related files + "SConstruct", + "Core/SConscript", + *env.Glob("Core/*/SConscript"), + "Core/ClientSMLSWIG/Python/SConscript", + + # 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", + + # 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 SOURCE_EXTS: + sdist_sources.extend( + env.Glob("Core/" + ("*/" * i) + "*." + ext) + ) + + 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 # the files in the correct places. env.Depends("editable", py_sources)