Andrew Tridgell пре 4 година
родитељ
комит
32ebd62a5a
4 измењених фајлова са 17 додато и 11 уклоњено
  1. 9 5
      app.py
  2. 4 3
      app.wsgi
  3. 3 2
      templates/generate.html
  4. 1 1
      templates/index.html

+ 9 - 5
app.py

@@ -88,20 +88,22 @@ def run_build(task, tmpdir, outdir):
     if not os.path.isfile(os.path.join(outdir, 'extra_hwdef.dat')):
         app.logger.error('Build aborted, missing extra_hwdef.dat')
     app.logger.info('Appending to build.log')
-    with open(os.path.join(outdir, 'build.log'), 'a') as log:
+    logpath = os.path.abspath(os.path.join(outdir, 'build.log'))
+    app.logger.info("LOGPATH: %s" % logpath)
+    with open(logpath, 'a') as log:
         app.logger.info('Running waf configure')
-        subprocess.run(['./waf', 'configure', 
+        subprocess.run(['python3', './waf', 'configure',
                         '--board', task['board'], 
                         '--out', tmpdir, 
                         '--extra-hwdef', task['extra_hwdef']],
                         cwd = task['sourcedir'], 
                         stdout=log, stderr=log)
         app.logger.info('Running clean')
-        subprocess.run(['./waf', 'clean'], 
+        subprocess.run(['python3', './waf', 'clean'],
                         cwd = task['sourcedir'], 
                         stdout=log, stderr=log)
         app.logger.info('Running build')
-        subprocess.run(['./waf', task['vehicle']], 
+        subprocess.run(['python3', './waf', task['vehicle']],
                         cwd = task['sourcedir'],
                         stdout=log, stderr=log)
 
@@ -201,8 +203,10 @@ def update_source():
 import optparse
 parser = optparse.OptionParser("app.py")
 
+
 parser.add_option("", "--basedir", type="string",
-                  default="/home/will/GitHub", help="base directory")
+                  default=os.path.abspath(os.path.join(os.path.dirname(__file__),"..","base")),
+                  help="base directory")
 cmd_opts, cmd_args = parser.parse_args()
                 
 # define directories

+ 4 - 3
app.wsgi

@@ -1,8 +1,9 @@
-#! /usr/bin/python3
+#!/usr/bin/env python3
 
 import logging
 import sys
+import os
 logging.basicConfig(stream=sys.stderr)
-sys.path.insert(0, '/home/will/GitHub/CustomBuild')
+sys.path.insert(0, os.path.dirname(__file__))
 from app import app as application
-application.secret_key = 'key'
+application.secret_key = 'key'

+ 3 - 2
templates/generate.html

@@ -33,10 +33,11 @@
             xhr.open('GET', "{{apache_build_log}}");
             xhr.onload = function() {
                 if (xhr.status == 200) {
-                    output.textContent = xhr.responseText; }
+                    output.textContent = xhr.responseText;
+                }
             }
             xhr.send();
-        }
+      }
       setInterval(reload,5000)
     </script>
 

+ 1 - 1
templates/index.html

@@ -7,7 +7,7 @@
 
         <p>Please select the required options for the reduced firmware build.</p>
 
-        <form action="/CustomBuild/generate" method="post">
+        <form action="/generate" method="post">
             <label for="vehicle">Choose a vehicle:</label>
             <select name="vehicle">
                 {% for vehicle in get_vehicles() %}