1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

Use getdeps.py to drive build of OSS CinderX

Summary: Add a "manifest" for CinderX allowing it and its dependencies to be built and tested with `getdeps.py`. There was no pre-existing "builder" that was appropriate for building a Python extension from source, but rather than adding one that's specific to Cinderx I've tried to write a general builder that uses `setup.py` to install the build into the Python install.

Reviewed By: alexmalyshev

Differential Revision: D79287319

fbshipit-source-id: d302bea10c6a79cdedc08cd93b0362259dea522b
This commit is contained in:
Jacob Bower
2025-08-01 01:53:45 -07:00
committed by Facebook GitHub Bot
parent 8c1e7cfbc2
commit 573aa3b6a1
3 changed files with 78 additions and 0 deletions

View File

@@ -1368,6 +1368,46 @@ class NopBuilder(BuilderBase):
simple_copytree(self.src_dir, self.inst_dir)
class SetupPyBuilder(BuilderBase):
def _build(self, reconfigure) -> None:
env = self._compute_env()
setup_py_path = os.path.join(self.src_dir, "setup.py")
if not os.path.exists(setup_py_path):
raise RuntimeError(f"setup.py script not found at {setup_py_path}")
self._check_cmd(
[path_search(env, "python3"), setup_py_path, "install"],
cwd=self.src_dir,
env=env,
)
# Create the installation directory if it doesn't exist
os.makedirs(self.inst_dir, exist_ok=True)
# Mark the project as built
with open(os.path.join(self.inst_dir, ".built-by-getdeps"), "w") as f:
f.write("built")
def run_tests(self, schedule_type, owner, test_filter, retry, no_testpilot) -> None:
# setup.py actually no longer has a standard command for running tests.
# Instead we let manifest files specify an arbitrary Python file to run
# as a test.
# Get the test command from the manifest
python_script = self.manifest.get(
"setup-py.test", "python_script", ctx=self.ctx
)
if not python_script:
print(f"No test script specified for {self.manifest.name}")
return
# Run the command
env = self._compute_env()
self._check_cmd(["python3", python_script], cwd=self.src_dir, env=env)
class SqliteBuilder(BuilderBase):
def __init__(
self,