Changes to import dynamically modules in ovim.py
[osm/openvim.git] / Makefile
1 #!/usr/bin/env bash
2 SHELL := /bin/bash
3
4 all: clean build pip install
5 lite: clean build_lite pip_lite install_lite
6
7 clean_deb:
8 rm -rf .build
9 clean:
10 rm -rf build
11 find osm_openvim -name '*.pyc' -delete
12 find osm_openvim -name '*.pyo' -delete
13
14 prepare_lite:
15 pip install --user --upgrade setuptools
16 mkdir -p build
17 VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
18 VER2=$(shell git describe | cut -d- -f2); \
19 VER3=$(shell git describe | cut -d- -f3); \
20 echo "$$VER1.dev$$VER2+$$VER3" > build/OVIM_VERSION
21 cp MANIFEST.in build/
22 sed -i "s/include OPENVIM_VERSION/include OVIM_VERSION/g" build/MANIFEST.in
23 sed -i "s/recursive-include osm_openvim/recursive-include lib_osm_openvim/g" build/MANIFEST.in
24 sed -i "s/include openflow/include openflow-lib/g" build/MANIFEST.in
25 sed -i '/include openvimd/d' build/MANIFEST.in
26 sed -i '/include openvim/d' build/MANIFEST.in
27 cp README_lite.rst build/README.rst
28 cp setup_lite.py build/setup.py
29 cp stdeb_lite.cfg build/stdeb.cfg
30 cp -r osm_openvim/ build/lib_osm_openvim
31 rm build/lib_osm_openvim/httpserver.py
32 rm build/lib_osm_openvim/openvimd.cfg
33 cp -r database_utils build/lib_osm_openvim/
34 cp -r scripts build/lib_osm_openvim/
35 cp openflow build/openflow-lib
36 sed -i "s/from osm_openvim/from lib_osm_openvim/g" build/openflow-lib
37 sed -i "s/import osm_openvim/import lib_osm_openvim/g" build/openflow-lib
38 sed -i "s/import osm_openvim; print osm_openvim\.__path__\[0\]/import lib_osm_openvim; print lib_osm_openvim\.__path__\[0\]/g" build/lib_osm_openvim/database_utils/migrate_vim_db.sh
39 sed -i "s/__import__(\"osm_openvim\.\"/__import__(\"lib_osm_openvim\.\"/g" build/lib_osm_openvim/ovim.py
40
41 prepare:
42 pip install --user --upgrade setuptools
43 mkdir -p build
44 VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
45 VER2=$(shell git describe | cut -d- -f2); \
46 VER3=$(shell git describe | cut -d- -f3); \
47 echo "$$VER1.dev$$VER2+$$VER3" > build/OPENVIM_VERSION
48 cp MANIFEST.in build/
49 cp README.rst build/
50 cp setup.py build/
51 cp stdeb.cfg build/
52 cp -r osm_openvim/ build/
53 cp -r scripts build/osm_openvim/
54 cp -r database_utils build/osm_openvim/
55 cp -r templates build/osm_openvim/
56 cp -r test build/osm_openvim/
57 cp -r charm build/osm_openvim/
58 cp openflow build/
59 cp openvim build/
60 cp openvimd build/
61
62 build: prepare
63 python -m py_compile build/osm_openvim/*.py
64
65 build_lite: prepare_lite
66 python -m py_compile build/lib_osm_openvim/*.py
67
68 pip: clean build
69 cd build && ./setup.py sdist
70
71 pip_lite: clean build_lite
72 cd build && ./setup.py sdist
73
74 package_openvim: clean prepare
75 #apt-get install -y python-stdeb
76 cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True
77 cd build && cp osm_openvim/scripts/python-osm-openvim.postinst deb_dist/osm-openvim*/debian/
78 cd build/deb_dist/osm-openvim* && dpkg-buildpackage -rfakeroot -uc -us
79 mkdir -p .build
80 cp build/deb_dist/python-*.deb .build/
81
82 package_lib: clean prepare_lite
83 #apt-get install -y python-stdeb
84 cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True
85 cd build/deb_dist/lib-osm-openvim* && dpkg-buildpackage -rfakeroot -uc -us
86 mkdir -p .build
87 cp build/deb_dist/python-*.deb .build/
88
89 package: clean_deb package_openvim package_lib
90
91 snap:
92 echo "Nothing to be done yet"
93
94 install: clean build
95 #cd build/dist; pip install --user osm_openvim*
96 cd build/dist; pip install osm_openvim*
97
98 install_lite: clean build_lite
99 #cd build/dist; pip install --user lib_osm_openvim-*
100 cd build/dist; pip install lib_osm_openvim-*
101
102