Reworked install scripts again

This commit is contained in:
krateng 2022-03-10 21:45:56 +01:00
parent cc2b984080
commit c944a3d937
17 changed files with 78 additions and 35 deletions

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
*.note
*.xcf
/nohup.out
/*-old
*-old
/*.yml
/pylintrc
.venv/*

View File

@ -11,10 +11,10 @@ Clone the repository and enter it.
To avoid cluttering your system, consider using a [virtual environment](https://docs.python.org/3/tutorial/venv.html).
Your system needs several packages installed. On Alpine, this can be done with
Your system needs several packages installed. For supported distributions, this can be done with e.g.
```console
sh ./dev/install_dependencies_alpine.sh
sh ./install/install_dependencies_alpine.sh
```
For other distros, try to find the equivalents of the packages listed or simply check your error output.

View File

@ -61,7 +61,7 @@ Your CPU should have a single core passmark score of at the very least 1500. Whe
### PyPI
You can download the included script `install_alpine.sh` and run it with
You can download one of the included scripts in the `install` folder and run it with e.g.
```console
sh install_alpine.sh
@ -73,7 +73,7 @@ You can also simply call the install command
pip install malojaserver
```
directly (e.g. if you're not on Alpine) - make sure you have all the system packages installed.
directly - make sure you have all the system packages installed.
### From Source
@ -84,10 +84,10 @@ Clone this repository and enter the directory with
cd maloja
```
Then install all the requirements and build the package:
Then install all the requirements and build the package, e.g.:
```console
sh ./install/install_dependencies.sh
sh ./install/install_dependencies_alpine.sh
pip install -r requirements.txt
pip install .
```

View File

@ -1,4 +0,0 @@
apk add \
gcc g++ python3-dev libxml2-dev libxslt-dev libffi-dev libc-dev py3-pip linux-headers \
python3 tzdata \
vips

View File

@ -1,4 +0,0 @@
apk add \
{{ tool.osreqs.alpine.build | join(' ') }} \
{{ tool.osreqs.alpine.run | join(' ') }} \
{{ tool.osreqs.alpine.opt | join(' ') }}

View File

@ -0,0 +1,4 @@
{% include 'install/install_dependencies_alpine.sh.jinja' %}
apk add py3-pip
pip install wheel
pip install malojaserver

View File

@ -0,0 +1,4 @@
{% include 'install/install_dependencies_debian.sh.jinja' %}
apt install python3-pip
pip install wheel
pip install malojaserver

View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
apk update
apk add \
{{ (tool.osreqs.alpine.build + tool.osreqs.alpine.run + tool.osreqs.alpine.opt) | join(' \\\n\t') }}

View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
apt update
apt install \
{{ (tool.osreqs.debian.build + tool.osreqs.debian.run + tool.osreqs.debian.opt) | join(' \\\n\t') }}

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
apk add \
{{ tool.osreqs.alpine.build | join(' \\\n\t') }} \
{{ tool.osreqs.alpine.run | join(' \\\n\t') }} \
{{ tool.osreqs.alpine.opt | join(' \\\n\t') }}
pip3 install wheel
pip3 install malojaserver

View File

@ -2,6 +2,12 @@ import toml
import os
import jinja2
env = jinja2.Environment(
loader=jinja2.FileSystemLoader('dev/templates'),
autoescape=jinja2.select_autoescape(['html', 'xml']),
keep_trailing_newline=True
)
with open("pyproject.toml") as filed:
data = toml.load(filed)
@ -9,20 +15,19 @@ templatedir = "./dev/templates"
for root,dirs,files in os.walk(templatedir):
relpath = os.path.relpath(root,start=templatedir)
reldirpath = os.path.relpath(root,start=templatedir)
for f in files:
relfilepath = os.path.join(reldirpath,f)
if not f.endswith('.jinja'): continue
srcfile = os.path.join(root,f)
trgfile = os.path.join(relpath,f.replace(".jinja",""))
trgfile = os.path.join(reldirpath,f.replace(".jinja",""))
with open(srcfile) as templatefiled:
template = jinja2.Template(templatefiled.read())
template = env.get_template(relfilepath)
result = template.render(**data)
with open(trgfile,"w") as filed:
filed.write(result)
filed.write('\n')

19
install/install_alpine.sh Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env sh
apk update
apk add \
gcc \
g++ \
python3-dev \
libxml2-dev \
libxslt-dev \
libffi-dev \
libc-dev \
py3-pip \
linux-headers \
python3 \
tzdata \
vips
apk add py3-pip
pip install wheel
pip install malojaserver

View File

@ -0,0 +1,9 @@
#!/usr/bin/env sh
apt update
apt install \
python3-pip \
python3
apt install python3-pip
pip install wheel
pip install malojaserver

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
apk update
apk add \
gcc \
g++ \
@ -12,5 +13,3 @@ apk add \
python3 \
tzdata \
vips
pip3 install wheel
pip3 install malojaserver

View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
apt update
apt install \
python3-pip \
python3

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
apt update
apt install python3 python3-pip
pip3 install malojaserver

View File

@ -68,3 +68,12 @@ run = [
opt = [
"vips"
]
[tool.osreqs.debian]
build = [
"python3-pip"
]
run = [
"python3"
]
opt = []