-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_rules.py
90 lines (62 loc) · 2.46 KB
/
build_rules.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
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Build rules for the makeprojects suite of build tools.
This file is parsed by the cleanme, buildme, rebuildme and makeprojects
command line tools to clean, build and generate project files.
When any of these tools are invoked, this file is loaded and parsed to
determine special rules on how to handle building the code and / or data.
"""
# pylint: disable=unused-argument
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
from burger import import_py_script, run_command
# If set to True, ``buildme -r``` will not parse directories in this folder.
BUILDME_NO_RECURSE = False
# ``buildme``` will build these files and folders first.
BUILDME_DEPENDENCIES = []
# If set to True, ``cleanme -r``` will not parse directories in this folder.
CLEANME_NO_RECURSE = False
# ``cleanme`` will clean the listed folders before cleaning this folder.
CLEANME_DEPENDENCIES = []
########################################
def build(working_directory, configuration):
"""
Build the module so it's ready for upload to Pypi with Twine.
On exit, return 0 for no error, or a non zero error code if there was an
error to report.
Args:
working_directory
Directory this script resides in.
configuration
Configuration to build, ``all`` if no configuration was requested.
Returns:
None if not implemented, otherwise an integer error code.
"""
# Call setup.py to create the distribution files.
run_command(
("python", "setup.py", "sdist", "bdist_wheel"),
working_dir=working_directory)
return 0
########################################
def clean(working_directory):
"""
Delete temporary files.
This function is called by ``cleanme`` to remove temporary files.
On exit, return 0 for no error, or a non zero error code if there was an
error to report.
Args:
working_directory
Directory this script resides in.
Returns:
None if not implemented, otherwise an integer error code.
"""
# The function exists in setup.py.
# It can be manually invoked with "setup.py clean"
setup = import_py_script(os.path.join(working_directory, "setup.py"))
setup.clean(working_directory)
return 0
# If called as a command line and not a class, perform the build
if __name__ == "__main__":
sys.exit(build(os.path.dirname(os.path.abspath(__file__)), "all"))