diff --git a/MANIFEST.in b/MANIFEST.in index 7e1cc57cc..74a09ff5c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -11,6 +11,7 @@ recursive-include wx/locale ** recursive-include wx/include ** recursive-include license *.txt include LICENSE.txt +include pyproject.toml graft docs prune docs/sphinx/build diff --git a/build.py b/build.py index a48b86db9..6e6c36954 100755 --- a/build.py +++ b/build.py @@ -43,7 +43,8 @@ phoenixDir, wxDir, copyIfNewer, copyFile, \ macSetLoaderNames, \ getVcsRev, runcmd, textfile_open, getSipFiles, \ - getVisCVersion, getToolsPlatformName, updateLicenseFiles + getVisCVersion, getToolsPlatformName, updateLicenseFiles, \ + updatePyprojectFile import buildtools.version as version @@ -180,6 +181,7 @@ def main(args): usage() sys.exit(1) + updatePyprojectFile() options, commands = parseArgs(args) cfg = Config(noWxConfig=True) diff --git a/buildtools/config.py b/buildtools/config.py index 0d99f1e7a..848dbfcc9 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -19,6 +19,7 @@ import shutil import subprocess import platform +import textwrap from distutils.file_util import copy_file from distutils.dir_util import mkpath @@ -969,3 +970,29 @@ def updateLicenseFiles(cfg): with open('LICENSE.txt', 'w') as f: f.write(text) + +def updatePyprojectFile(): + """ + Create or update a pyproject.toml file based on the contents of + requirements/*.txt files. + """ + assert os.getcwd() == phoenixDir() + target = 'pyproject.toml' + txt_files = glob.glob('requirements/*.txt') + if not os.path.exists(target) or any([newer(src, target) for src in txt_files]): + with open(target, "w") as output: + output.write(textwrap.dedent("""\ + # Generated from {} + + [build-system] + # Requirements for building and/or testing wxPython Phoenix + requires = [ + """.format(txt_files))) + for tf in txt_files: + for line in open(tf).readlines(): + line = line.strip() + if line[0] not in ['-', '#']: + output.write(" '{}',\n".format(line)) + output.write(' ]\n') + msg("Updated {}".format(target)) + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..91585e760 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +# Generated from ['requirements/devel.txt', 'requirements/install.txt'] + +[build-system] +# Requirements for building and/or testing wxPython Phoenix +requires = [ + 'appdirs', + 'setuptools', + 'wheel', + 'twine', + 'sphinx==1.4.5', + 'requests', + 'pytest', + 'pytest-xdist', + 'pytest-timeout', + 'pathlib2 ; python_version < "3"', + 'backports.shutil_which ; python_version < "3"', + 'textwrap3 ; python_version < "3"', + 'numpy', + 'pillow', + 'six', + ]