Commits

Michael[tm] Smith committed fd11eb4

make it possible to build and run on Windows (b=715, thx=CareyEvans)
http://bugzilla.validator.nu/show_bug.cgi?id=715

Comments (0)

Files changed (1)

 import zipfile
 import sys
 from sgmllib import SGMLParser
+import subprocess
 
 javacCmd = 'javac'
 jarCmd = 'jar'
           self.leaves.append(self.baseUrl + value)    
     
 def runCmd(cmd):
-  if os.name == 'nt':
-    cmd = cmd.replace('"', '')
-    print cmd
-    os.system(cmd)    
+  print cmd
+  if os.name == 'nt' and cmd[:1] == '"':
+    subprocess.call(cmd)
   else:
-    print cmd
     os.system(cmd)
 
 def execCmd(cmd, args):
   print "%s %s" % (cmd, " ".join(args))
-  if os.execvp(cmd, [cmd,] + args):
-    print "Command failed."
-    sys.exit(2)
+  if os.name == 'nt':
+    if subprocess.call([cmd,] + args):
+      print "Command failed."
+      sys.exit(2)
+  else:
+    if os.execvp(cmd, [cmd,] + args):
+      print "Command failed."
+      sys.exit(2)
 
 def removeIfExists(filePath):
   if os.path.exists(filePath):
   else:
     f.write("\n".join(sourceFiles))
   f.close()
-  runCmd('"%s" -nowarn -classpath "%s" -sourcepath "%s" -d "%s" %s'\
+  runCmd('"%s" -g -nowarn -classpath "%s" -sourcepath "%s" -d "%s" %s'\
 		% (javacCmd, classPath, sourceDir, classDir, "@temp-javac-list"))
   removeIfExists("temp-javac-list")
 
   if pageTemplate:
     ioJar  = os.path.join("util", "dist", "io-xml-util.jar")
     pageEmitter = os.path.join("validator", "src", "nu", "validator", "servlet", "PageEmitter.java")
-    runCmd('"%s" -cp %s nu.validator.tools.SaxCompiler %s %s' % (javaCmd, ioJar, pageTemplate, pageEmitter))
+    runCmd('"%s" -classpath %s nu.validator.tools.SaxCompiler %s %s' % (javaCmd, ioJar, pageTemplate, pageEmitter))
   classPath = os.pathsep.join(dependencyJarPaths() 
                               + jarNamesToPaths(["non-schema", 
                                                 "io-xml-util",
     '-Xms%sk' % heap,
     '-Xmx%sk' % heap,
     '-XX:ThreadStackSize=2048',
-    '-cp',
+    '-classpath',
     classPath,
     '-Dnu.validator.servlet.log4j-properties=' + log4jProps,
     '-Dnu.validator.servlet.version=3',
   runCmd('"%s" co "%s" "%s"' % (svnCmd, svnRoot + 'build' + '/trunk/', 'build'))
   newArgv = [sys.executable, buildScript, '--no-self-update']
   newArgv.extend(argv)
-  os.execv(sys.executable, newArgv)  
+  if os.name == 'nt':
+    sys.exit(subprocess.call(newArgv))
+  else:
+    os.execv(sys.executable, newArgv)  
 
 
 def runTests():
                                                 "html5-datatypes",
                                                 "test-harness"])
                               + jingJarPath())
-  runCmd('"%s" -cp %s org.whattf.syntax.Driver' % (javaCmd, classPath))
+  runCmd('"%s" -classpath %s org.whattf.syntax.Driver' % (javaCmd, classPath))
 
 def splitHostSpec(spec):
   index = spec.find('/')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.