-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
34 lines (28 loc) · 1.01 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
#
# Makefile for the umaudemc tool
#
# Python command to be included in the shebang
PYTHON ?= /usr/bin/env python3
# Bundle the all the Python and data file into single executable zip file
# (based on Stack Overflow's question 17486578)
RESOURCES = umaudemc/data/*.maude umaudemc/data/*.js umaudemc/data/*.css umaudemc/data/*.htm
CODE = umaudemc/*.py umaudemc/*/*.py
dist/umaudemc: dist $(RESOURCES) $(CODE)
# Create temporary directory and copy the package into it
mkdir -p zip
cp -r umaudemc zip
# Create a __main__ file for the package that invokes the umaudemc one
echo -e 'import sys\nfrom umaudemc.__main__ import main\nsys.exit(main())' > zip/__main__.py
touch -ma zip/* zip/*/*
# Compress that directory into a zip file
cd zip ; zip -q ../umaudemc.zip $(RESOURCES) $(CODE) __main__.py
rm -rf zip
# Put the shebang and then the zip file into the executable bundle
echo '#!$(PYTHON)' > $@
cat umaudemc.zip >> $@
rm umaudemc.zip
chmod a+x $@
wheel:
pip wheel --no-deps -w dist .
dist:
mkdir -p dist