Update Win build defaults with min fallbacks
This commit is contained in:
@@ -4,6 +4,7 @@ from cStringIO import StringIO
|
|||||||
import gzip
|
import gzip
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import glob
|
||||||
import regex as re
|
import regex as re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@@ -13,60 +14,59 @@ from pake import ifind, main, output, rule, target, variables, virtual, which
|
|||||||
|
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
""" windows_defaults assumes that jsdoc was installed at a specific place
|
|
||||||
(C:\jsdoc). It also fixes a certain version (1.9.0) of phantomjs which
|
|
||||||
might not anymore be proposed on
|
|
||||||
http://code.google.com/p/phantomjs/downloads/list"""
|
|
||||||
|
|
||||||
windows_defaults = {
|
win = {
|
||||||
'ProgramFiles': os.environ.get('ProgramFiles', 'C:\\Program Files'),
|
'GIT': 'git.exe',
|
||||||
'Python27': os.environ.get('SystemDrive', 'C:') + '\\Python27',
|
'GJSLINT': 'gjslint.exe',
|
||||||
'jsdoc': os.environ.get('SystemDrive', 'C:') + '\\jsdoc3',
|
'JAVA': 'java.exe',
|
||||||
'phantomjs': (os.environ.get('SystemDrive', 'C:') +
|
'JAR': 'jar.exe',
|
||||||
'\\phantomjs-1.9.0-windows')
|
'JSDOC': 'jsdoc.cmd',
|
||||||
|
'PYTHON': 'python.exe',
|
||||||
|
'PHANTOMJS': 'phantomjs.cmd'
|
||||||
}
|
}
|
||||||
|
|
||||||
if which('git.exe'):
|
sys_dir = os.environ.get('SYSTEMDRIVE')
|
||||||
variables.GIT = 'git.exe'
|
program_files = os.environ.get('PROGRAMFILES')
|
||||||
else:
|
java_home = os.environ.get('JAVA_HOME')
|
||||||
variables.GIT = os.path.join(windows_defaults['ProgramFiles'],
|
|
||||||
'Git', 'bin', 'git.exe')
|
|
||||||
|
|
||||||
if which('gjslint.exe'):
|
if not java_home:
|
||||||
variables.GJSLINT = 'gjslint.exe'
|
# Following lines choose sensible defaults to guess JAVA_HOME in
|
||||||
else:
|
# 32/64bit Program Files folder opting for the most current version.
|
||||||
variables.GJSLINT = os.path.join(windows_defaults['Python27'],
|
search_term = os.path.join(sys_dir, os.sep, 'Program Files*', 'Java', 'jdk*')
|
||||||
'Scripts', 'gjslint.exe')
|
found_jdks = sorted(glob.glob(search_term), key=lambda x: x[-8:])
|
||||||
|
if found_jdks:
|
||||||
|
java_home = found_jdks[-1]
|
||||||
|
|
||||||
if which('java.exe'):
|
if java_home:
|
||||||
variables.JAVA = 'java.exe'
|
if not which(win['JAVA']):
|
||||||
else:
|
win['JAVA'] = os.path.join(java_home, 'bin', 'java.exe')
|
||||||
variables.JAVA = os.path.join(windows_defaults['ProgramFiles'],
|
if not which(win['JAR']):
|
||||||
'Java', 'jre7', 'bin', 'java.exe')
|
win['JAR'] = os.path.join(java_home, 'bin', 'jar.exe')
|
||||||
|
elif not which(win['JAVA']):
|
||||||
|
win['JAVA'] = os.path.join(program_files,
|
||||||
|
'Java', 'jre7', 'bin', 'java.exe')
|
||||||
|
|
||||||
if which('jar.exe'):
|
if not which(win['GIT']):
|
||||||
variables.JAR = 'jar.exe'
|
win['GIT'] = os.path.join(program_files, 'Git', 'cmd', 'git.exe')
|
||||||
else:
|
if not which(win['GIT']):
|
||||||
variables.JAR = os.path.join(windows_defaults['ProgramFiles'],
|
win['GIT'] = os.path.join(program_files, 'Git', 'bin', 'git.exe')
|
||||||
'Java', 'jdk1.7.0_17', 'bin', 'jar.exe')
|
|
||||||
|
|
||||||
if which('jsdoc.cmd'):
|
if not which(win['PYTHON']):
|
||||||
variables.JSDOC = 'jsdoc.cmd'
|
win['PYTHON'] = os.path.join(sys_dir, 'Python27', 'python.exe')
|
||||||
else:
|
|
||||||
variables.JSDOC = os.path.join(windows_defaults['jsdoc'],
|
|
||||||
'jsdoc.cmd')
|
|
||||||
|
|
||||||
if which('python.exe'):
|
if not which(win['GJSLINT']):
|
||||||
variables.PYTHON = 'python.exe'
|
win['GJSLINT'] = os.path.join(sys_dir, 'Python27', 'Scripts', 'gjslint.exe')
|
||||||
else:
|
|
||||||
variables.PYTHON = os.path.join(windows_defaults['Python27'],
|
|
||||||
'python.exe')
|
|
||||||
|
|
||||||
if which('phantomjs.exe'):
|
if not which(win['PHANTOMJS']):
|
||||||
variables.PHANTOMJS = 'phantomjs.exe'
|
win['PHANTOMJS'] = 'phantomjs.exe'
|
||||||
else:
|
if not which(win['PHANTOMJS']):
|
||||||
variables.PHANTOMJS = os.path.join(windows_defaults['phantomjs'],
|
win['PHANTOMJS'] = os.path.join(sys_dir, 'phantomjs-1.9.7-windows', 'phantomjs.exe')
|
||||||
'phantomjs.exe')
|
|
||||||
|
if not which(win['JSDOC']):
|
||||||
|
win['JSDOC'] = os.path.join(program_files, 'jsdoc3', 'jsdoc.cmd')
|
||||||
|
|
||||||
|
for program, path in win.iteritems():
|
||||||
|
setattr(variables, program, path)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
variables.GIT = 'git'
|
variables.GIT = 'git'
|
||||||
|
|||||||
Reference in New Issue
Block a user