image build

This commit is contained in:
codl 2017-08-11 14:57:32 +02:00
parent 5a02d75f7c
commit 1a9753db49
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
10 changed files with 41 additions and 1 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
__pycache__
celerybeat-schedule
.doit.db
static/logotype*.png

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

26
dodo.py Normal file
View File

@ -0,0 +1,26 @@
def task_gen_logo():
"""generate versions of the logo in various sizes"""
from PIL import Image
widths = (200, 400, 600, 800)
def gen_logo():
with Image.open('assets/logotype.png') as im:
im = im.convert('L')
for width in widths:
height = im.height * width // im.width
new = im.resize((width,height), resample=Image.LANCZOS)
new.save('static/logotype-{}.png'.format(width))
im.save('static/logotype.png')
return {
'actions': [gen_logo],
'targets': [f'static/logotype-{width}.png' for width in widths]\
+ ['static/logotype.png'],
'file_dep': ['assets/logotype.png'],
}
if __name__ == '__main__':
import doit
doit.run(globals())

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

View File

@ -4,7 +4,9 @@ billiard==3.5.0.3
blinker==1.4
celery==4.1.0
click==6.7
cloudpickle==0.4.0
contextlib2==0.5.5
doit==0.30.3
Flask==0.12.2
Flask-Limiter==0.9.5
Flask-Migrate==2.0.4
@ -18,7 +20,10 @@ kombu==4.1.0
limits==1.2.1
Mako==1.0.6
MarkupSafe==1.0
olefile==0.44
Pillow==4.2.1
psycopg2==2.7.1
pyinotify==0.9.6
python-dateutil==2.6.0
python-editor==1.0.3
pytz==2017.2

View File

@ -17,7 +17,9 @@
<header>
<h1>
<a href="{{url_for('index')}}">
<img src="{{ st('logotype.png') }}" alt="Forget" width=200 />
<img src="{{ st('logotype-200.png') }}" alt="Forget" width=200 srcset="{% for width in (200,400,600,800) -%}
{{ st('logotype-{}.png'.format(width)) }} {{width}}w,
{%- endfor %}"/>
</a>
</h1>
</header>

View File

@ -15,6 +15,11 @@ while read old new refname; do
pip install -r requirements.txt
tools/write-version.sh
FLASK_APP='forget.py' flask db upgrade
if [[ $(git diff --name-only ${old}..${new} dodo.py) == 'dodo.py' ]]
then
doit forget
fi
doit
)
systemctl --user start forget
fi