forked from jbmohler/matplotlib-winbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildall.py
48 lines (37 loc) · 1.72 KB
/
buildall.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
import sys
import os
import shutil
import utils
import optparse
def main(options):
utils.build_tcl()
utils.build_zlib()
utils.build_libpng()
utils.build_freetype()
shutil.copy(os.path.join(utils.DEPSSRC, 'stdint.h'), os.path.join(utils.config_dir(), 'stdint.h'))
if 'LIB' in os.environ:
os.environ['LIB'] = '{};{}'.format(os.environ['LIB'], utils.config_dir())
else:
os.environ['LIB'] = utils.config_dir()
os.environ['LIB'] = '{};{}'.format(os.environ['LIB'], os.path.join(os.path.dirname(sys.executable), 'tcl'))
if 'INCLUDE' in os.environ:
os.environ['INCLUDE'] = '{};{};{}'.format(os.environ['INCLUDE'], utils.config_dir(), utils.tcl_config_dir())
else:
os.environ['INCLUDE'] = '{};{}'.format(utils.config_dir(), utils.tcl_config_dir())
os.chdir(options.mpl_dir)
if options.use_pip:
os.system('pip install -e .')
else:
os.system('{} setup.py {}'.format(sys.executable, options.setup_cmd))
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option('--use_pip', '-p', action="store_true", dest="use_pip",
default=False, help="Whether to use `pip install -e .`")
mydir = os.path.dirname(os.path.abspath(__file__))
default_path = os.path.join(mydir, '..', 'matplotlib')
parser.add_option('--mpl_dir', '-d', action="store", dest="mpl_dir",
default=default_path, help="Matplotlib repo directory")
parser.add_option('--setup_cmd', '-s', action="store", dest="setup_cmd",
default="install", help="Command to pass to setup.py")
options, rem = parser.parse_args()
main(options)