File: OpenSCAD_Test_Console.py

package info (click to toggle)
openscad 2015.03-2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 30,804 kB
  • ctags: 5,692
  • sloc: cpp: 39,386; sh: 3,856; ansic: 3,674; python: 1,393; yacc: 496; lex: 272; lisp: 159; makefile: 67; xml: 60
file content (56 lines) | stat: -rw-r--r-- 1,706 bytes parent folder | download
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
# Openscad Test Console
#
# Script to make it easier to pull up a command-line console or
# running Ctest under Windows(TM)
#
# public domain, by Don Bright <hugh.m.bright@gmail.com>

import os,sys

thisfile_abspath=os.path.abspath(__file__)
thisdir_abspath=os.path.abspath(os.path.dirname(thisfile_abspath))

starting_dir=os.path.join(thisdir_abspath,'tests-build')
print 'changing current folder to '+starting_dir
os.chdir(starting_dir)

print 'adding ',starting_dir,'folder to sys.path'
sys.path.append(starting_dir)

build_dir=starting_dir

print 'converting CTestTestfile.cmake by calling mingw_convert_test.py'
import mingw_convert_ctest
mingw_convert_ctest.run()

print 'searching for ctest.exe'
ctestpath=''
for basedir in 'C:/Program Files','C:/Program Files (x86)':
        if os.path.isdir(basedir):
		pflist = os.listdir(basedir)
		for subdir in pflist:
			if 'cmake' in subdir.lower():
				abssubdir=os.path.join(basedir,subdir)
				for root,dirs,files in os.walk(abssubdir):
					if 'ctest.exe' in files:
						ctestpath=os.path.join(root,'ctest.exe')

if not os.path.isfile(ctestpath):
        print 'error, cant find ctest.exe'
else:
	ctestdir = os.pathsep + os.path.dirname(ctestpath)
	print 'adding ctest dir to PATH:',ctestdir
	os.environ['PATH'] += ctestdir

#cmd = 'start "OpenSCAD Test console" /wait /d c:\\temp cmd.exe'
#cmd = 'start /d "'+starting_dir+'" cmd.exe "OpenSCAD Test Console"'
conbat=os.path.join(build_dir,'mingwcon.bat')
cmd = 'start /d "'+starting_dir+'" cmd.exe "/k" "'+conbat+'"'
print 'opening console: running ',cmd
os.system( cmd )

# figure out how to run convert script
# dont use mingw64 in linbuild path?
# figure out better windows prompt, can it be set?