Mac OS with zsh - CompressFiles never ends #66
Do not overcomplicate things, just run os.system.
This commit is contained in:
parent
bea9152103
commit
7b12df99fe
@ -19,20 +19,19 @@ def GetVersion (rootDir):
|
||||
return packageJson['version']
|
||||
|
||||
def JSHintFolder (folder):
|
||||
result = Tools.RunCommand (['jshint', folder])
|
||||
result = Tools.RunCommand ('jshint', [folder])
|
||||
if result != 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
def CompressFiles (inputFiles, outputFile):
|
||||
parameters = []
|
||||
parameters.append ('google-closure-compiler')
|
||||
for inputFile in inputFiles:
|
||||
extension = os.path.splitext (inputFile)[1]
|
||||
if extension == '.js':
|
||||
parameters.append ('--js=' + os.path.join ('..', inputFile))
|
||||
parameters.append ('--js_output_file=' + outputFile)
|
||||
result = Tools.RunCommand (parameters)
|
||||
result = Tools.RunCommand ('google-closure-compiler', parameters)
|
||||
if result != 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
@ -13,13 +13,9 @@ def WriteContentToFile (filePath, content):
|
||||
fileObject.write (content)
|
||||
fileObject.close ()
|
||||
|
||||
def RunCommand (commands):
|
||||
process = subprocess.Popen (commands, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
|
||||
out, err = process.communicate ()
|
||||
if process.returncode != 0:
|
||||
print (out.decode ())
|
||||
print (err.decode ())
|
||||
return process.returncode
|
||||
def RunCommand (executable, arguments):
|
||||
command = executable + ' "' + '" "'.join (arguments) + '"'
|
||||
return os.system (command)
|
||||
|
||||
class TokenReplacer:
|
||||
def __init__ (self, filePath, keepToken):
|
||||
|
||||
@ -7,8 +7,7 @@ def Main (argv):
|
||||
currentDir = os.path.dirname (os.path.abspath (__file__))
|
||||
os.chdir (currentDir)
|
||||
imagesPath = os.path.abspath (os.path.join ('..', 'website', 'assets', 'images'))
|
||||
for i in range (0, 5):
|
||||
Tools.RunCommand (['svgo', '-r', imagesPath])
|
||||
Tools.RunCommand ('svgo', ['-r', imagesPath])
|
||||
return 0
|
||||
|
||||
sys.exit (Main (sys.argv))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user