| 1 | # Use setup.py for the installation instead of Autoconf. |
| 2 | # This ease the installation process and assure a *pythonic* |
| 3 | # installation. |
| 4 | all-local: |
| 5 | $(PYTHON) setup.py build --verbose |
| 6 | |
| 7 | install-exec-local: |
| 8 | @opts="--prefix=$(prefix) --verbose --no-compile $(DISTSETUPOPTS)"; \ |
| 9 | if [ "$(DESTDIR)" != "" ]; then \ |
| 10 | opts="$$opts --root=$(DESTDIR)"; \ |
| 11 | fi; \ |
| 12 | $(PYTHON) setup.py install $$opts; |
| 13 | |
| 14 | clean-local: |
| 15 | rm -rf $(builddir)/build |
| 16 | |
| 17 | # Distutils' setup.py does not include an uninstall target, we thus need to do |
| 18 | # it manually. We fake an install in a temporary folder and use the generated |
| 19 | # tree structure to infere the actual location within the install prefix. |
| 20 | # 1. Create temporary file and folder |
| 21 | # 2. Set the root install folder for a temporary folder |
| 22 | # 3. Install in that temporary folder and record all the files installed |
| 23 | # 4. If DESTDIR is set, prepend it to the paths of the install files |
| 24 | # 5. Remove the installed files and the Python package folder |
| 25 | # 6. Remove the files created by this target |
| 26 | |
| 27 | uninstall-local: |
| 28 | $(eval TMP_INSTALLED_FILES:=$(shell mktemp $(builddir)/tmp-installed-files-XXXXXX)) |
| 29 | $(eval TMP_INSTALL_DIR:=$(shell mktemp -d $(builddir)/tmp-install-dir-XXXXXX)) |
| 30 | $(eval TMP_BUILD_DIR:=$(shell mktemp -d $(builddir)/tmp-build-dir-XXXXXX)) |
| 31 | @opts="--root=$(TMP_INSTALL_DIR) --prefix=$(prefix) --record $(TMP_INSTALLED_FILES) --no-compile $(DISTSETUPOPTS)"; \ |
| 32 | if [ "$(DESTDIR)" != "" ]; then \ |
| 33 | opts="$$opts --root=$(DESTDIR)"; \ |
| 34 | else \ |
| 35 | opts="$$opts --root=$(TMP_INSTALL_DIR)"; \ |
| 36 | fi; \ |
| 37 | $(PYTHON) setup.py build --build-base $(TMP_BUILD_DIR) install $$opts > /dev/null || true |
| 38 | |
| 39 | if [ "$(DESTDIR)" != "" ]; then \ |
| 40 | $(SED) -i "s|^|$(DESTDIR)/|g" $(TMP_INSTALLED_FILES); \ |
| 41 | fi |
| 42 | |
| 43 | cat $(TMP_INSTALLED_FILES) | xargs rm -rf || true |
| 44 | $(GREP) "__init__.py" $(TMP_INSTALLED_FILES) | xargs dirname | xargs rm -rf || true |
| 45 | rm -f $(TMP_INSTALLED_FILES) |
| 46 | rm -rf $(TMP_INSTALL_DIR) |
| 47 | rm -rf $(TMP_BUILD_DIR) |