forked from andete/madparts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
madparts
executable file
·40 lines (33 loc) · 1008 Bytes
/
madparts
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
#!/usr/bin/env python
#
# (c) 2013-2015 Joost Yervante Damad <joost@damad.be>
# License: GPL
import sys, os
usage = """
Usage:
%s <footprint_file>
"""
if __name__ == '__main__':
# trick needed to make OpenGL work on win32
from ctypes import util
try:
from OpenGL.platform import win32
except AttributeError:
pass
# if there is a file called 'Makefile' in the same directory
# as this script, we're running from the development tree
dirname = os.path.dirname(os.path.abspath(sys.argv[0]))
in_dev_tree = os.path.exists(os.path.join(dirname, 'Makefile'))
if in_dev_tree:
print "in dev tree"
data_dir = dirname
else:
data_dir = os.path.join(sys.prefix, 'share', 'madparts')
sys.path.append(data_dir)
os.environ['DATA_DIR'] = data_dir
import main.madparts
file_name = None
if len(sys.argv) >= 2:
file_name = sys.argv[1]
print 'opening file', file_name
sys.exit(main.madparts.gui_main(file_name))