commit | author | age
|
7589de
|
1 |
# |
MT |
2 |
# This file and its contents are supplied under the terms of the |
|
3 |
# Common Development and Distribution License ("CDDL"), version 1.0. |
|
4 |
# You may only use this file in accordance with the terms of version |
|
5 |
# 1.0 of the CDDL. |
|
6 |
# |
|
7 |
# A full copy of the text of the CDDL should have accompanied this |
|
8 |
# source. A copy of the CDDL is also available via the Internet at |
|
9 |
# http://www.illumos.org/license/CDDL. |
|
10 |
# |
|
11 |
|
|
12 |
# |
|
13 |
# Copyright 2022 Marcel Telka |
|
14 |
# |
|
15 |
|
|
16 |
include $(WS_MAKE_RULES)/setup.py.mk |
|
17 |
|
c6fba2
|
18 |
ifeq ($(strip $(PYTHON_BOOTSTRAP)),yes) |
MT |
19 |
# To bootstrap the bootstrapper we need to make sure it finds its own modules |
7c8106
|
20 |
ifeq ($(strip $(COMPONENT_NAME)),pyproject_installer) |
c6fba2
|
21 |
PYTHON_ENV += PYTHONPATH=$(@D)/src |
MT |
22 |
endif |
|
23 |
|
d0dd84
|
24 |
COMPONENT_BUILD_CMD = $(PYTHON) -m pyproject_installer build |
MT |
25 |
COMPONENT_BUILD_ARGS = |
c6fba2
|
26 |
|
d0dd84
|
27 |
COMPONENT_INSTALL_CMD = $(PYTHON) -m pyproject_installer install |
MT |
28 |
COMPONENT_INSTALL_ARGS = |
|
29 |
COMPONENT_INSTALL_ARGS += --destdir $(PROTO_DIR) |
c6fba2
|
30 |
|
MT |
31 |
# pyproject_installer does not bytecompile after the install. Since we need |
|
32 |
# pyc files we need to force that. |
d0dd84
|
33 |
COMPONENT_POST_INSTALL_ACTION += \ |
202847
|
34 |
$(PYTHON) -m compileall $(PROTO_DIR)/$(PYTHON_DIR)/site-packages $(PROTO_DIR)/$(PYTHON_LIB) ; |
c6fba2
|
35 |
else |
7589de
|
36 |
COMPONENT_BUILD_CMD = $(PYTHON) -m build |
MT |
37 |
COMPONENT_BUILD_ARGS = |
|
38 |
COMPONENT_BUILD_ARGS += --wheel |
|
39 |
COMPONENT_BUILD_ARGS += --no-isolation |
|
40 |
|
|
41 |
COMPONENT_INSTALL_CMD = $(PYTHON) -m installer |
|
42 |
COMPONENT_INSTALL_ARGS = |
|
43 |
COMPONENT_INSTALL_ARGS += --destdir $(PROTO_DIR) |
|
44 |
COMPONENT_INSTALL_ARGS += $(@D)/dist/*.whl |
|
45 |
|
eb37ff
|
46 |
USERLAND_REQUIRED_PACKAGES.python += library/python/build |
MT |
47 |
USERLAND_REQUIRED_PACKAGES.python += library/python/installer |
7589de
|
48 |
endif |
MT |
49 |
|
|
50 |
# Move all modules from default site-packages directory to vendor-packages |
|
51 |
# directory where we place modules shipped by the OS but not included in the |
|
52 |
# core Python distribution. |
|
53 |
COMPONENT_POST_INSTALL_ACTION += \ |
|
54 |
if [ -d $(PROTO_DIR)/$(PYTHON_DIR)/site-packages ] ; then \ |
|
55 |
$(RM) -r $(PROTO_DIR)/$(PYTHON_LIB) ; \ |
|
56 |
$(MV) $(PROTO_DIR)/$(PYTHON_DIR)/site-packages $(PROTO_DIR)/$(PYTHON_LIB) ; \ |
|
57 |
fi ; |
27f6d6
|
58 |
|
MT |
59 |
# Add build dependencies from project metadata to REQUIRED_PACKAGES |
|
60 |
REQUIRED_PACKAGES_RESOLVED += $(BUILD_DIR)/META.depend.res |
|
61 |
$(BUILD_DIR)/META.depend.res: $(SOURCE_DIR)/.prep |
|
62 |
$(MKDIR) $(BUILD_DIR) |
cdf120
|
63 |
# PYTHON_ENV is needed four times here to have the PYTHONPATH set |
MT |
64 |
# properly when we bootstrap the pyproject_installer bootstrapper. |
d0dd84
|
65 |
$(PYTHON_ENV) $(PYTHON) -m pyproject_installer deps --depsconfig $(BUILD_DIR)/pyproject_deps.json add build_pep517 pep517 |
MT |
66 |
$(PYTHON_ENV) $(PYTHON) -m pyproject_installer deps --depsconfig $(BUILD_DIR)/pyproject_deps.json add build_pep518 pep518 |
|
67 |
cd $(SOURCE_DIR) ; $(PYTHON_ENV) $(PYTHON) -m pyproject_installer deps --depsconfig $(BUILD_DIR)/pyproject_deps.json sync |
|
68 |
$(PYTHON_ENV) $(PYTHON) -m pyproject_installer deps --depsconfig $(BUILD_DIR)/pyproject_deps.json eval --depformat '$$nname' \ |
27f6d6
|
69 |
| $(GSED) -e 's/.*/depend type=require fmri=pkg:\/library\/python\/&-$$(PYV)/' \ |
MT |
70 |
> $@ |
03a645
|
71 |
# PYTHON_ENV (see above) needs BITS |
MT |
72 |
$(BUILD_DIR)/META.depend.res: BITS = $(PREFERRED_BITS) |
27f6d6
|
73 |
|
MT |
74 |
# We need pyproject_installer for two purposes: |
|
75 |
# - to detect build dependencies for all Python projects, and |
|
76 |
# - to bootstrap some other Python projects. |
|
77 |
# The pyproject_installer is not needed (and cannot be needed) for its own |
|
78 |
# build. |
|
79 |
ifneq ($(strip $(COMPONENT_NAME)),pyproject_installer) |
eb37ff
|
80 |
USERLAND_REQUIRED_PACKAGES.python += library/python/pyproject-installer |
27f6d6
|
81 |
endif |