mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Update to Python 3.10
This commit is contained in:
parent
c3a4ea239c
commit
c2fbf7603a
@ -1,4 +1,4 @@
|
|||||||
FROM python:3.6
|
FROM python:3.10
|
||||||
|
|
||||||
RUN groupadd -g 5123 cdb && \
|
RUN groupadd -g 5123 cdb && \
|
||||||
useradd -r -u 5123 -g cdb cdb
|
useradd -r -u 5123 -g cdb cdb
|
||||||
|
@ -65,7 +65,7 @@ login_manager.init_app(app)
|
|||||||
login_manager.login_view = "users.login"
|
login_manager.login_view = "users.login"
|
||||||
|
|
||||||
|
|
||||||
from .sass import sass
|
from .sass import init_app as sass
|
||||||
sass(app)
|
sass(app)
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ class Package(db.Model):
|
|||||||
lazy="dynamic", order_by=db.asc("package_screenshot_order"), cascade="all, delete, delete-orphan")
|
lazy="dynamic", order_by=db.asc("package_screenshot_order"), cascade="all, delete, delete-orphan")
|
||||||
|
|
||||||
main_screenshot = db.relationship("PackageScreenshot", uselist=False, foreign_keys="PackageScreenshot.package_id",
|
main_screenshot = db.relationship("PackageScreenshot", uselist=False, foreign_keys="PackageScreenshot.package_id",
|
||||||
lazy=True, order_by=db.asc("package_screenshot_order"),
|
lazy=True, order_by=db.asc("package_screenshot_order"), viewonly=True,
|
||||||
primaryjoin="and_(Package.id==PackageScreenshot.package_id, PackageScreenshot.approved)")
|
primaryjoin="and_(Package.id==PackageScreenshot.package_id, PackageScreenshot.approved)")
|
||||||
|
|
||||||
cover_image_id = db.Column(db.Integer, db.ForeignKey("package_screenshot.id"), nullable=True, default=None)
|
cover_image_id = db.Column(db.Integer, db.ForeignKey("package_screenshot.id"), nullable=True, default=None)
|
||||||
|
43
app/sass.py
43
app/sass.py
@ -12,16 +12,16 @@ Code unabashedly adapted from https://github.com/weapp/flask-coffee2js
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import codecs
|
import codecs
|
||||||
from flask import *
|
import sass
|
||||||
from scss import Scss
|
from flask import send_from_directory
|
||||||
|
|
||||||
def _convert(dir, src, dst):
|
|
||||||
|
def _convert(dir_path, src, dst):
|
||||||
original_wd = os.getcwd()
|
original_wd = os.getcwd()
|
||||||
os.chdir(dir)
|
os.chdir(dir_path)
|
||||||
|
|
||||||
css = Scss()
|
|
||||||
source = codecs.open(src, 'r', encoding='utf-8').read()
|
source = codecs.open(src, 'r', encoding='utf-8').read()
|
||||||
output = css.compile(source)
|
output = sass.compile(string=source)
|
||||||
|
|
||||||
os.chdir(original_wd)
|
os.chdir(original_wd)
|
||||||
|
|
||||||
@ -29,8 +29,9 @@ def _convert(dir, src, dst):
|
|||||||
outfile.write(output)
|
outfile.write(output)
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|
||||||
def _getDirPath(app, originalPath, create=False):
|
|
||||||
path = originalPath
|
def _get_dir_path(app, original_path, create=False):
|
||||||
|
path = original_path
|
||||||
|
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
path = os.path.join(app.root_path, path)
|
path = os.path.join(app.root_path, path)
|
||||||
@ -39,25 +40,25 @@ def _getDirPath(app, originalPath, create=False):
|
|||||||
if create:
|
if create:
|
||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
else:
|
else:
|
||||||
raise IOError("Unable to find " + originalPath)
|
raise IOError("Unable to find " + original_path)
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def sass(app, inputDir='scss', outputPath='static', force=False, cacheDir="public/static"):
|
|
||||||
static_url_path = app.static_url_path
|
def init_app(app, input_dir='scss', dest='static', force=False, cache_dir="public/static"):
|
||||||
inputDir = _getDirPath(app, inputDir)
|
input_dir = _get_dir_path(app, input_dir)
|
||||||
cacheDir = _getDirPath(app, cacheDir or outputPath, True)
|
cache_dir = _get_dir_path(app, cache_dir or dest, True)
|
||||||
|
|
||||||
def _sass(filepath):
|
def _sass(filepath):
|
||||||
sassfile = "%s/%s.scss" % (inputDir, filepath)
|
scss_file = "%s/%s.scss" % (input_dir, filepath)
|
||||||
cacheFile = "%s/%s.css" % (cacheDir, filepath)
|
cache_file = "%s/%s.css" % (cache_dir, filepath)
|
||||||
|
|
||||||
# Source file exists, and needs regenerating
|
# Source file exists, and needs regenerating
|
||||||
if os.path.isfile(sassfile) and (force or not os.path.isfile(cacheFile) or
|
if os.path.isfile(scss_file) and (force or not os.path.isfile(cache_file) or
|
||||||
os.path.getmtime(sassfile) > os.path.getmtime(cacheFile)):
|
os.path.getmtime(scss_file) > os.path.getmtime(cache_file)):
|
||||||
_convert(inputDir, sassfile, cacheFile)
|
_convert(input_dir, scss_file, cache_file)
|
||||||
app.logger.debug('Compiled %s into %s' % (sassfile, cacheFile))
|
app.logger.debug('Compiled %s into %s' % (scss_file, cache_file))
|
||||||
|
|
||||||
return send_from_directory(cacheDir, filepath + ".css")
|
return send_from_directory(cache_dir, filepath + ".css")
|
||||||
|
|
||||||
app.add_url_rule("/%s/<path:filepath>.css" % outputPath, 'sass', _sass)
|
app.add_url_rule("/%s/<path:filepath>.css" % dest, 'sass', _sass)
|
||||||
|
@ -7,17 +7,15 @@ beautifulsoup4==4.10.0
|
|||||||
billiard==3.6.4.0
|
billiard==3.6.4.0
|
||||||
bleach==4.1.0
|
bleach==4.1.0
|
||||||
blinker==1.4
|
blinker==1.4
|
||||||
cached-property==1.5.2
|
celery==5.2.3
|
||||||
celery==5.1.2
|
|
||||||
certifi==2021.10.8
|
certifi==2021.10.8
|
||||||
cffi==1.15.0
|
cffi==1.15.0
|
||||||
charset-normalizer==2.0.10
|
charset-normalizer==2.0.10
|
||||||
click==7.1.2
|
click==8.0.3
|
||||||
click-didyoumean==0.3.0
|
click-didyoumean==0.3.0
|
||||||
click-plugins==1.1.1
|
click-plugins==1.1.1
|
||||||
click-repl==0.2.0
|
click-repl==0.2.0
|
||||||
coverage==6.2
|
coverage==6.3
|
||||||
dataclasses==0.8
|
|
||||||
decorator==5.1.1
|
decorator==5.1.1
|
||||||
Deprecated==1.2.13
|
Deprecated==1.2.13
|
||||||
dnspython==2.2.0
|
dnspython==2.2.0
|
||||||
@ -34,31 +32,29 @@ Flask-WTF==1.0.0
|
|||||||
git-archive-all==1.23.0
|
git-archive-all==1.23.0
|
||||||
gitdb==4.0.9
|
gitdb==4.0.9
|
||||||
GitHub-Flask==3.2.0
|
GitHub-Flask==3.2.0
|
||||||
GitPython==3.1.18
|
GitPython==3.1.26
|
||||||
greenlet==1.1.2
|
greenlet==1.1.2
|
||||||
gunicorn==20.1.0
|
gunicorn==20.1.0
|
||||||
idna==3.3
|
idna==3.3
|
||||||
importlib-metadata==4.8.3
|
|
||||||
importlib-resources==5.4.0
|
|
||||||
iniconfig==1.1.1
|
iniconfig==1.1.1
|
||||||
itsdangerous==2.0.1
|
itsdangerous==2.0.1
|
||||||
Jinja2==3.0.3
|
Jinja2==3.0.3
|
||||||
kombu==5.1.0
|
kombu==5.2.3
|
||||||
|
libsass==0.21.0
|
||||||
lxml==4.7.1
|
lxml==4.7.1
|
||||||
Mako==1.1.6
|
Mako==1.1.6
|
||||||
Markdown==3.3.6
|
Markdown==3.3.6
|
||||||
MarkupSafe==2.0.1
|
MarkupSafe==2.0.1
|
||||||
packaging==21.3
|
packaging==21.3
|
||||||
passlib==1.7.4
|
passlib==1.7.4
|
||||||
Pillow==8.4.0
|
Pillow==9.0.0
|
||||||
pluggy==1.0.0
|
pluggy==1.0.0
|
||||||
prompt-toolkit==3.0.26
|
prompt-toolkit==3.0.26
|
||||||
psycopg2-binary==2.9.3
|
psycopg2==2.9.3
|
||||||
py==1.11.0
|
py==1.11.0
|
||||||
pycparser==2.21
|
pycparser==2.21
|
||||||
Pygments==2.11.2
|
Pygments==2.11.2
|
||||||
pyparsing==3.0.7
|
pyparsing==3.0.7
|
||||||
pyScss==1.3.7
|
|
||||||
pytest==6.2.5
|
pytest==6.2.5
|
||||||
pytest-cov==3.0.0
|
pytest-cov==3.0.0
|
||||||
pytz==2021.3
|
pytz==2021.3
|
||||||
@ -72,8 +68,7 @@ SQLAlchemy==1.4.31
|
|||||||
SQLAlchemy-Searchable==1.4.1
|
SQLAlchemy-Searchable==1.4.1
|
||||||
SQLAlchemy-Utils==0.38.2
|
SQLAlchemy-Utils==0.38.2
|
||||||
toml==0.10.2
|
toml==0.10.2
|
||||||
tomli==1.2.3
|
tomli==2.0.0
|
||||||
typing_extensions==4.0.1
|
|
||||||
ua-parser==0.10.0
|
ua-parser==0.10.0
|
||||||
urllib3==1.26.8
|
urllib3==1.26.8
|
||||||
user-agents==2.2.0
|
user-agents==2.2.0
|
||||||
@ -83,6 +78,5 @@ wcwidth==0.2.5
|
|||||||
webencodings==0.5.1
|
webencodings==0.5.1
|
||||||
Werkzeug==2.0.2
|
Werkzeug==2.0.2
|
||||||
wrapt==1.13.3
|
wrapt==1.13.3
|
||||||
WTForms==3.0.0
|
WTForms==3.0.1
|
||||||
WTForms-SQLAlchemy==0.3
|
WTForms-SQLAlchemy==0.3
|
||||||
zipp==3.6.0
|
|
||||||
|
@ -24,7 +24,7 @@ GitPython
|
|||||||
git-archive-all
|
git-archive-all
|
||||||
lxml
|
lxml
|
||||||
pillow
|
pillow
|
||||||
pyScss
|
libsass
|
||||||
redis
|
redis
|
||||||
psycopg2
|
psycopg2
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ BASE_URL="http://" + SERVER_NAME
|
|||||||
SECRET_KEY="changeme"
|
SECRET_KEY="changeme"
|
||||||
WTF_CSRF_SECRET_KEY="changeme"
|
WTF_CSRF_SECRET_KEY="changeme"
|
||||||
|
|
||||||
SQLALCHEMY_DATABASE_URI = "postgres://contentdb:password@db:5432/contentdb"
|
SQLALCHEMY_DATABASE_URI = "postgresql://contentdb:password@db:5432/contentdb"
|
||||||
|
|
||||||
GITHUB_CLIENT_ID = ""
|
GITHUB_CLIENT_ID = ""
|
||||||
GITHUB_CLIENT_SECRET = ""
|
GITHUB_CLIENT_SECRET = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user