This repository has been archived by the owner on Jan 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmfPythonDefs.mk
72 lines (62 loc) · 2.92 KB
/
mfPythonDefs.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
## Python
PYTHON_VERSION = $(shell python -c "import distutils.sysconfig;print(distutils.sysconfig.get_python_version())")
# PYTHON_VERSION = $(shell python -c "import sys; sys.stdout.write(sys.version[:3])")
PYTHON_LIB = python$(PYTHON_VERSION)
PYTHON_LIB_PREFIX = $(shell python -c "from distutils.sysconfig import get_python_lib;import os.path;print(os.path.split(get_python_lib(standard_lib=True))[0])")
PYTHON_SITE_PREFIX = $(shell python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
PYTHON_INCLUDE_PREFIX = $(shell python -c "import distutils.sysconfig;print(distutils.sysconfig.get_python_inc())")
# Python Config
PYTHONCFLAGS = $(shell pkg-config python --cflags)
PYTHONLIBS = $(shell pkg-config python --libs)
PYTHONGLIBS = $(shell pkg-config python --glibs)
IncludeDirs+=$(PYTHON_INCLUDE_PREFIX)
# DependentLibraries+=python$(PYTHON_VERSION)
# DynamicLinkFlags+=
.PHONY: install-pip install-site uninstall-pip uninstall-site
## @python-common install the python pip package
install-pip: pip
ifneq ($(or $(ThisIsAnEmptyVariable),$(RPM_DIR),$(PackageName),$(PACKAGE_FULL_VERSION),$(PREREL_VERSION)),)
pip install $(RPM_DIR)/$(PackageName)-$(PACKAGE_FULL_VERSION)$(PREREL_VERSION).zip
else
@echo "install-pip require that certain arguments are set"
@echo "ThisIsAnEmptyVariable is $(ThisIsAnEmptyVariable)"
@echo "RPM_DIR is $(RPM_DIR)"
@echo "PackageName is $(PackageName)"
@echo "PACKAGE_FULL_VERSION is $(PACKAGE_FULL_VERSION)"
@echo "PREREL_VERSION is $(PREREL_VERSION)"
@exit 2
# $(error "Unable to run install-site due to unset variables")
endif
ifeq ($(and $(ThisIsAnEmptyVariable),$(Namespace),$(ShortPackage),$(INSTALL_PREFIX),$(PYTHON_SITE_PREFIX),$(CMSGEMOS_ROOT)),)
install-site uninstall-site: fail-pyinstall
fail-pyinstall:
@echo "install-site require that certain arguments are set"
@echo "ThisIsAnEmptyVariable is $(ThisIsAnEmptyVariable)"
@echo "Namespace is $(Namespace)"
@echo "ShortPackage is $(ShortPackage)"
@echo "INSTALL_PREFIX is $(INSTALL_PREFIX)"
@echo "PYTHON_SITE_PREFIX is $(PYTHON_SITE_PREFIX)"
@exit 2
# $(error "Unable to run install-site due to unset variables")
endif
## @python-common install the python site-package
install-site: _rpmprep
ifneq ($(Arch),arm)
$(MakeDir) $(INSTALL_PREFIX)$(PYTHON_SITE_PREFIX)/$(Namespace)/$(ShortPackage)
@if [ -d pkg ]; then \
cd pkg; \
find $(Namespace) \( -type d -iname scripts \) -prune -o -type f \
-exec install -D -m 755 {} $(INSTALL_PREFIX)$(PYTHON_SITE_PREFIX)/{} \; ; \
cd $(Namespace)/scripts; \
find . -type f \
-exec install -D -m 755 {} $(INSTALL_PREFIX)$(CMSGEMOS_ROOT)/bin/$(ShortPackage)/{} \; ; \
fi
endif
## @python-common uninstall the python pip package
uninstall-pip:
pip uninstall $(PackageName)
## @python-common uninstall the python site-package
uninstall-site:
ifneq ($(Arch),arm)
$(RM) $(INSTALL_PREFIX)$(PYTHON_SITE_PREFIX)/$(Namespace)/$(ShortPackage)
endif