This repository has been archived by the owner on Jan 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
149 lines (122 loc) · 3.29 KB
/
Makefile
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
SHELL := /bin/bash
PROJECT := py-translate
VERSION := 2
PYTHON := $(shell which python$(VERSION))
OSNAME := $(shell uname -s)
ARCH := $(shell uname -m)
PIP := pip$(VERSION)
APP := py-translate
TEST := test
DOCKER_TAG := jjangsangy/python3:3.5.0b4
INSTALL := Miniconda$(subst 2,,$(VERSION))-latest-$(subst Darwin,MacOSX,$(OSNAME))-$(ARCH).sh
URL := http://repo.continuum.io/miniconda/${INSTALL}
CONDA := miniconda/bin/conda
IPYTHON := miniconda/bin/ipython
CACHE := cache
BIN := node_modules/.bin
NPM := $(BIN)/npm
BOWER := $(BIN)/bower
NVM := https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh
NVM_DIR := $(PWD)/nvm
LOAD := ./$(CACHE)/$(INSTALL)
.PHONY: all
all: install
.PHONY: miniconda
miniconda: $(CONDA)
$(CONDA) update conda
$(CONDA):
@echo $(LAOD)
@echo "installing Miniconda"
@if [ -x $(which curl) ]; then \
curl -O $(URL) -o $(LOAD); \
elif [ -x $(which wget) ]; then \
wget $(URL) -o $(LOAD); \
fi
@if [ -r miniconda ]; then rm -rf miniconda; fi
@bash $(INSTALL) -b -p miniconda
$(CONDA) create -n venv python=$(VERSION)*
.PHONY: help
help:
@echo " Usage: \`make <target>'"
@echo " ======================="
@echo " npm install npm and nodejs"
@echo " bower install bower and javascript"
@echo " serve serve ipython notebook on port 8000"
@echo " clean remove build files"
@echo " miniconda boostrap anacondas python"
@echo
@echo
.PHONY: ipython
ipython: $(CONDA)
@echo "Installing IPython"
$(IPYTHON):
@echo "Installing Required Packages"
$(CONDA) install -y anaconda
npm: $(NVM_DIR)/nvm.sh
@echo "Installing NodeJS Packages"
@test -d $(BIN) || mkdir -p $(BIN)
npm install .
$(NVM_DIR)/nvm.sh:
@echo "Installing NVM"
@git clone https://github.com/creationix/nvm.git
source nvm/nvm.sh && nvm install stable && nvm use stable && npm install .
.PHONY: bower
bower: npm
@echo "Installing Javascript Packages"
@$(NPM) install --loglevel silent .
bower.json: bower
$(bower) init
@$(BOWER) install
.PHONY: install
install: miniconda npm bower
@echo "Installing Packages"
.PHONY: serve
serve: install
$(IPYTHON)/ipython nbconvert --serve Qadium.ipynb
.PHONY: clean
clean:
rm -rf node_modules
rm -rf venv
rm -rf .DS_Store
rm -rf miniconda
rm -rf nvm
venv: venv/bin/activate
venv/bin/activate: requirements.txt
test -d venv || virtualenv --python=$(PYTHON) venv
source venv/bin/activate; \
$(PIP) install --upgrade pip setuptools wheel; \
$(PIP) install -r requirements.txt --upgrade
touch venv/bin/activate
.PHONY: clean wheel publish docker bash daemon
all:
$(PYTHON) setup.py build
build: venv
source env/bin/activate; \
$(PYTHON) setup.py install
install:
$(PIP) install -e .
test: build
source venv/bin/activate; \
$(PIP) install -r test_requirements.txt --upgrade; \
$(PYTHON) setup.py $(TEST)
wheel:
$(PYTHON) setup.py bdist_wheel
publish:
$(PYTHON) setup.py build nosetests
$(PYTHON) setup.py sdist upload -r pypi
$(PYTHON) setup.py bdist_wheel upload -r pypi
clean:
rm -rf $(APP)/*.pyc
rm -rf __pycache__
rm -rf $(APP)/__pycache__
rm -rf build
rm -rf *egg-info
rm -rf dist
rm -rf venv
if [ -f "$(SCRIPT)" ]; then rm "$(SCRIPT)"; fi
docker:
docker build -t $(DOCKER_TAG) .
bash:
docker run -i -t $(DOCKER_TAG) /bin/bash -l
daemon:
docker run -d -P $(DOCKER_TAG)