Skip to content

Commit

Permalink
build: call into API directly
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Jan 18, 2024
1 parent fab4102 commit 7248bc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions setupsrc/pypdfium2_setup/craft_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
from pypdfium2_setup.packaging_base import *
from pypdfium2_setup.emplace import prepare_setup

try:
import build.__main__ as build_module
except ImportError:
build_module = None


P_PYPI = "pypi"
P_CONDA_RAW = "conda_raw"
Expand Down Expand Up @@ -78,9 +83,11 @@ def main():
assert False


def _run_pypi_build(args):
def _run_pypi_build(caller_args):
# -nx: --no-isolation --skip-dependency-check
run_cmd([sys.executable, "-m", "build", "-nx"] + args, cwd=ProjectDir, env=os.environ)
assert build_module, "Module 'build' is not importable. Cannot craft PyPI packages."
with tmp_cwd_context(ProjectDir):
build_module.main([str(ProjectDir), "-nx", *caller_args])


def main_pypi(args):
Expand Down
2 changes: 1 addition & 1 deletion setupsrc/pypdfium2_setup/packaging_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
BindingsFN = "bindings.py"
VersionFN = "version.json"

ProjectDir = Path(__file__).parents[2]
ProjectDir = Path(__file__).parents[2].resolve()
DataDir = ProjectDir / "data"
DataDir_Bindings = DataDir / "bindings"
SourcebuildDir = ProjectDir / "sourcebuild"
Expand Down

0 comments on commit 7248bc4

Please sign in to comment.