Commit 6e1ff036 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

add a builder that can re-package python wheel files

Summary:
Add a new builder that can extract Python wheel files, and re-package them
for consumption by our add_fb_python_library() and add_fb_python_executable()
CMake functions.  This is useful for dependencies on packages from PyPI.

At the moment this code only handles architecture-independent pure-Python
packages.  It shouldn't be too hard to extend this to handle more complex
wheels, but for now I only need to use it for some pure-Python wheels and so I
haven't tested with more complex wheel files.

This also includes two new manifests for python-six and python-toml that take
use this new builder.

Reviewed By: wez

Differential Revision: D17401216

fbshipit-source-id: d6f74565887c3f004e1c06503dc9ec81599dd697
parent f14e7cb7
#!/usr/bin/env python
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
......
......@@ -168,7 +168,7 @@ class ManifestLoader(object):
ctx = self.ctx_gen.get_context(m.name)
dep_list = sorted(m.get_section_as_dict("dependencies", ctx).keys())
builder = m.get("build", "builder", ctx=ctx)
if builder == "cmake":
if builder in ("cmake", "python-wheel"):
dep_list.append("cmake")
elif builder == "autoconf" and m.name not in (
"autoconf",
......
......@@ -28,6 +28,7 @@ from .fetcher import (
ShipitTransformerFetcher,
SimpleShipitTransformerFetcher,
)
from .py_wheel_builder import PythonWheelBuilder
try:
......@@ -383,6 +384,11 @@ class ManifestParser(object):
build_options, ctx, self, src_dir, build_dir, inst_dir, defines
)
if builder == "python-wheel":
return PythonWheelBuilder(
build_options, ctx, self, src_dir, build_dir, inst_dir
)
if builder == "sqlite":
return SqliteBuilder(build_options, ctx, self, src_dir, build_dir, inst_dir)
......
This diff is collapsed.
[manifest]
name = python-six
[download]
url = https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
sha256 = 3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c
[build]
builder = python-wheel
[manifest]
name = python-toml
[download]
url = https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
sha256 = 235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e
[build]
builder = python-wheel
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment