forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e30744a
commit 0977095
Showing
2 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
[project] | ||
name = "compiled" | ||
version = "0.2.1" | ||
description = "Compiled versions of the stdlib." | ||
# TODO: Add README | ||
authors = [ | ||
{name = "Tushar Sadhwani", email = "[email protected]"}, | ||
] | ||
requires-python = ">=3.11" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/tusharsadhwani/compiled" | ||
|
||
[project.scripts] | ||
pycompile = "compiled:cli" | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools", | ||
"wheel", | ||
"mypy[mypyc]", | ||
] | ||
|
||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
TEST_BASE_DIR = os.path.join(ROOT_DIR, "Lib/test") | ||
TMP_LIB_DIR = "/tmp/pycompiled" | ||
|
||
PACKAGE_VERSION = "0.2.1" | ||
SUPPORTED_LIBRARIES = ["tomllib", "difflib"] | ||
|
||
# get rid of this once mypyc fixes relative imports | ||
|
@@ -239,38 +238,31 @@ def main() -> int: | |
init_file.write(contents) | ||
|
||
# copy cibuildwheel config to build dir | ||
shutil.copy("./cibw_config.toml", build_dir) | ||
pyproject_toml_path = os.path.join(build_dir, "pyproject.toml") | ||
shutil.copy("./_compiled_pyproject.toml", pyproject_toml_path) | ||
|
||
# setup.py contains the `pycompile` console script, present in `__init__.py` | ||
with contextlib.chdir(build_dir): | ||
setup_code = dedent( | ||
# TODO: use a setup.cfg for README, version, and all the static stuff. | ||
r""" | ||
from setuptools import setup, find_packages | ||
from mypyc.build import mypycify | ||
setup( | ||
name="compiled", | ||
version=%r, | ||
description="Compiled versions of the stdlib.", | ||
long_description="# compiled\n\nCompiled versions of the stdlib.", | ||
url="https://github.com/tusharsadhwani/compiled", | ||
author="Tushar Sadhwani", | ||
author_email="[email protected]", | ||
packages=find_packages(), | ||
ext_modules=mypycify(["--strict", *%r]), | ||
entry_points={ | ||
"console_scripts": ["pycompile=compiled:cli"], | ||
}, | ||
) | ||
""" | ||
% (PACKAGE_VERSION, ext_modules) | ||
% (ext_modules,) | ||
) | ||
with open("./setup.py", "w") as setup_file: | ||
setup_file.write(setup_code) | ||
|
||
process = subprocess.run(["cibuildwheel", "--config-file=cibw_config.toml"]) | ||
process = subprocess.run(["cibuildwheel"]) | ||
return process.returncode | ||
|
||
library_name = args.library | ||
|