Skip to content

Commit

Permalink
Merge pull request #785 from lnls-sirius/improve-install
Browse files Browse the repository at this point in the history
Improve installation
  • Loading branch information
anacso17 authored Feb 4, 2022
2 parents fe8ff28 + 2c1badc commit 1473725
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions siriuspy/Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
DISTPATH=$(shell python-sirius -c "import site; print(site.getsitepackages())" | cut -f2 -d"'")
PACKAGE:=$(shell basename $(shell pwd))
ISINST=$(shell sudo pip-sirius show $(PACKAGE) | wc -l )
EGGLINK=$(DISTPATH)/$(PACKAGE).egg-link
TMPFOLDER=/tmp/install-$(PACKAGE)
PREFIX=
PIP=pip
ifeq ($(CONDA_PREFIX),)
PREFIX=sudo -H
PIP=pip-sirius
endif

clean:
git clean -fdX

develop: uninstall
pip-sirius install --no-deps -e ./
install: clean uninstall
$(PREFIX) $(PIP) install --no-deps ./

install: uninstall
ifneq (, $(wildcard $(TMPFOLDER)))
rm -rf /tmp/install-$(PACKAGE)
endif
cp -rRL ../$(PACKAGE) /tmp/install-$(PACKAGE)
cd /tmp/install-$(PACKAGE)/; sudo -H pip-sirius install --no-deps ./
rm -rf /tmp/install-$(PACKAGE)
uninstall:
$(PREFIX) $(PIP) uninstall -y $(PACKAGE)

develop-install: clean develop-uninstall
$(PIP) install --no-deps -e ./

# known issue: It will fail to uninstall scripts
# if they were installed in develop mode
uninstall: clean
ifneq (,$(wildcard $(EGGLINK)))
rm -r $(EGGLINK)
endif
ifneq ($(ISINST),0)
pip-sirius uninstall -y $(PACKAGE)
sed -i '/$(PACKAGE)/d' $(DISTPATH)/easy-install.pth
else
echo 'already uninstalled $(PACKAGE)'
endif
develop-uninstall:
$(PIP) uninstall -y $(PACKAGE)

test:
test:
pytest tests/

dist: clean ## Build setuptools dist
Expand Down

0 comments on commit 1473725

Please sign in to comment.