missing tools moment

This commit is contained in:
Letter N
2020-08-15 17:04:48 +08:00
parent a327e7d33f
commit a95cb5472d
4 changed files with 27 additions and 6 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
#!/bin/bash
#!/bin/sh
exec tools/hooks/python.sh -m merge_driver_dmi "$@"
+2 -1
View File
@@ -1,2 +1,3 @@
#!/bin/bash
#!/bin/sh
# `sh` must be used here instead of `bash` to support GitHub Desktop.
exec tools/hooks/python.sh -m precommit
+9 -4
View File
@@ -1,17 +1,22 @@
#!/bin/bash
#!/bin/sh
# `sh` must be used here instead of `bash` to support GitHub Desktop.
set -e
if command -v python3 >/dev/null 2>&1; then
PY=python3
else
elif command -v python >/dev/null 2>&1; then
PY=python
elif command -v py >/dev/null 2>&1; then
PY=py
else
echo "Please install Python 3.6 or later."
fi
PATHSEP=$($PY - <<'EOF'
import sys, os
if sys.version_info.major != 3 or sys.version_info.minor < 6:
sys.stderr.write("Python 3.6+ is required: " + sys.version + "\n")
sys.stderr.write("Python 3.6 or later is required, but you have:\n" + sys.version + "\n")
exit(1)
print(os.pathsep)
EOF
)
export PYTHONPATH=tools/mapmerge2/${PATHSEP}${PYTHONPATH}
$PY "$@"
exec $PY "$@"
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env python3
from http.server import HTTPServer, SimpleHTTPRequestHandler
import os
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Methods', 'GET')
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
return super(CORSRequestHandler, self).end_headers()
os.makedirs('../data/asset-store/', exist_ok=True)
os.chdir('../data/asset-store/')
httpd = HTTPServer(('localhost', 58715), CORSRequestHandler)
httpd.serve_forever()