-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.py
51 lines (46 loc) · 1.49 KB
/
Makefile.py
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
from metamake import task, shell, path, bootstrap
bootstrap("Makefile")
MODULENAME = "pivotaltracker"
@task
def build():
"""builds everything into a source distribution"""
shell("python setup.py sdist")
@task
def install():
"""installs the latest built module"""
tarballs = sorted(path("dist").listdir("*.tar.gz"))
if not tarballs:
build()
tarballs = sorted(path("dist").listdir("*.tar.gz"))
latest = tarballs[-1]
shell("easy_install --upgrade %s" % latest)
@task
def release():
"""releases this code + documentation to pypi"""
shell("python setup.py register")
shell("python setup.py sdist upload")
@task
def clean():
"""cleans all intermediate files"""
if path("MANIFEST").exists():
path("MANIFEST").remove()
if path("build").exists():
path("build").rmtree()
if path("dist").exists():
path("dist").rmtree()
patterns = ["*.coverage", "*.sqlite", "*.csv", "*.prof", "*.egg-info", "*.so", "*.dll", "*.c", "*.pyc"]
def recursive_remove_pyc(p):
for f in p.listdir("*"):
if f.isdir():
recursive_remove_pyc(f)
elif f.endswith(".pyc"):
f.remove()
recursive_remove_pyc(path("."))
for p in patterns:
for d in [".", "tests", MODULENAME]:
if path(d).exists():
for f in path(d).listdir(p):
if f.isdir():
f.rmtree()
else:
f.remove()