summaryrefslogtreecommitdiff
path: root/build.py
blob: 40646e52929e21cb20c7d9e39551a0530569170c (plain)
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
#!/usr/bin/env python
"""Xnt Build File"""

import xnt

@xnt.target
def clean():
    """Removes Generated folders"""
    xnt.rm("Xnt.egg-info",
           "build",
           "docs/build",
           "dist",
           "README.html",
           "**/*.pyc",
           "**/**/*.pyc",
           "**__pycache__",
           "**/**/__pycache__")

@xnt.target
def build():
    """Build Xnt"""
    return xnt.setup(["build"])

@xnt.target
def test():
    """Tests package"""
    error_codes = []
    print("Python Tests:")
    error_codes.append(xnt.setup(["test"]))
    clean()
    if xnt.in_path("python2"):
        print("Python2 Tests:")
        error_codes.append(xnt.call(["python2", "setup.py", "test"]))
        clean()
    return sum(error_codes)

@xnt.target
def lint():
    """pylint xnt"""
    return xnt.call(["pylint", "--rcfile=pylint.conf", "xnt"])

@xnt.target
def install():
    """Install Xnt"""
    error_code = xnt.setup(["install", "--user"])
    clean()
    return error_code

@xnt.target
def doc():
    """
    Create package documentation
    """
    return xnt.setup(["build_sphinx"])