mirror of https://github.com/VLSIDA/OpenRAM.git
Flask directory upload POC, embed datasheet.info in html comment for parser reuse
This commit is contained in:
parent
0dd97e54dd
commit
fa27d647d2
|
|
@ -7,6 +7,7 @@ from in_out import *
|
||||||
from hierarchy_design import total_drc_errors
|
from hierarchy_design import total_drc_errors
|
||||||
from hierarchy_design import total_lvs_errors
|
from hierarchy_design import total_lvs_errors
|
||||||
import os
|
import os
|
||||||
|
import csv
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
|
|
||||||
class datasheet():
|
class datasheet():
|
||||||
|
|
@ -40,6 +41,12 @@ class datasheet():
|
||||||
DRC = 'skipped'
|
DRC = 'skipped'
|
||||||
LVS = 'skipped'
|
LVS = 'skipped'
|
||||||
PEX = 'skipped'
|
PEX = 'skipped'
|
||||||
|
|
||||||
|
with open(OPTS.openram_temp + "/datasheet.info") as info:
|
||||||
|
self.html += '<!--'
|
||||||
|
for row in info:
|
||||||
|
self.html += row
|
||||||
|
self.html +='-->'
|
||||||
|
|
||||||
self.html += '<img src=' + os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/vlsi_logo.png alt="VLSIDA"><img src=' + os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/openram_logo_placeholder.png alt="OpenRAM">'
|
self.html += '<img src=' + os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/vlsi_logo.png alt="VLSIDA"><img src=' + os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/openram_logo_placeholder.png alt="OpenRAM">'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
import requests
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
# TODO
|
||||||
|
# copy directory structure
|
||||||
|
# relative links to not break dataseets?
|
||||||
|
# look into proper string and packet sanitization
|
||||||
|
# index gui + results graphs
|
||||||
|
|
||||||
|
base_url = 'http://localhost:5000/'
|
||||||
|
upload_url = 'upload'
|
||||||
|
|
||||||
|
def send_file(path):
|
||||||
|
upload_file = open(path,'rb')
|
||||||
|
data = {'file' : upload_file}
|
||||||
|
return requests.post(url = base_url + upload_url, files = data)
|
||||||
|
|
||||||
|
def send_mkdir(path):
|
||||||
|
|
||||||
|
def send_directory(path):
|
||||||
|
for root, directories, filenames in os.walk(path):
|
||||||
|
for filename in filenames:
|
||||||
|
upload_file = os.path.join(root,filename)
|
||||||
|
print(upload_file)
|
||||||
|
print(send_file(upload_file))
|
||||||
|
|
||||||
|
send_directory(sys.argv[1])
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
test
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import os
|
||||||
|
from flask import Flask, render_template, request
|
||||||
|
from werkzeug import secure_filename
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/uploader', methods = ['GET', 'POST'])
|
||||||
|
def upload():
|
||||||
|
if request.method == 'POST':
|
||||||
|
f = request.files['file']
|
||||||
|
dirname = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
f.save(dirname + '/uploads/' + secure_filename(f.filename))
|
||||||
|
return 'file uploaded successfully'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(debug = True)
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<form action = "http://localhost:5000/uploader" method = "POST"
|
||||||
|
enctype = "multipart/form-data">
|
||||||
|
<input type = "file" name = "file" />
|
||||||
|
<input type = "submit"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue