Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add pyproject.toml #1253

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -180,6 +181,7 @@ def main(args):
usage()
sys.exit(1)

updatePyprojectFile()
options, commands = parseArgs(args)

cfg = Config(noWxConfig=True)
Expand Down
27 changes: 27 additions & 0 deletions buildtools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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',
]