Compare commits
5 Commits
main
...
wip/pre-co
Author | SHA1 | Date |
---|---|---|
Frédéric Péters | 7876936d5d | |
Frédéric Péters | 16dd8aed9f | |
Frédéric Péters | 143e7356c9 | |
Frédéric Péters | fdab8a9b6a | |
Frédéric Péters | abb2903bb6 |
|
@ -0,0 +1,22 @@
|
|||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.7.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ['--profile', 'black', '--line-length', '110']
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.20.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py37-plus']
|
||||
- repo: https://git.entrouvert.org/pre-commit-debian.git
|
||||
rev: v0.1
|
||||
hooks:
|
||||
- id: pre-commit-debian
|
|
@ -4,6 +4,19 @@ pipeline {
|
|||
agent any
|
||||
options { disableConcurrentBuilds() }
|
||||
stages {
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh 'tox -rv'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
utils = new Utils()
|
||||
utils.publish_pylint('pylint.out')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Packaging') {
|
||||
steps {
|
||||
script {
|
||||
|
|
|
@ -12,7 +12,7 @@ Build-Depends: debhelper-compat (= 12),
|
|||
python3-pil,
|
||||
python3-setuptools,
|
||||
sassc,
|
||||
zlib1g-dev
|
||||
zlib1g-dev,
|
||||
Standards-Version: 3.9.1
|
||||
|
||||
Package: python3-gadjo
|
||||
|
|
|
@ -11,6 +11,7 @@ from django.contrib.staticfiles import utils
|
|||
from django.contrib.staticfiles.finders import BaseFinder
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
try:
|
||||
from importlib import import_module
|
||||
except ImportError:
|
||||
|
@ -22,6 +23,7 @@ class XStaticStorage(FileSystemStorage):
|
|||
A file system storage backend that takes an xstatic package module and works
|
||||
for the data contained in it.
|
||||
"""
|
||||
|
||||
prefix = 'xstatic'
|
||||
|
||||
def __init__(self, package, *args, **kwargs):
|
||||
|
@ -33,7 +35,7 @@ class XStaticStorage(FileSystemStorage):
|
|||
except ImportError:
|
||||
raise ImproperlyConfigured('Cannot import module "%s"' % package)
|
||||
location = package.BASE_DIR
|
||||
super(XStaticStorage, self).__init__(location, *args, **kwargs)
|
||||
super().__init__(location, *args, **kwargs)
|
||||
|
||||
|
||||
class XStaticFinder(BaseFinder):
|
||||
|
@ -58,12 +60,12 @@ class XStaticFinder(BaseFinder):
|
|||
self.storages[app] = app_storage
|
||||
if app not in self.apps:
|
||||
self.apps.append(app)
|
||||
super(XStaticFinder, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def find(self, path, all=False):
|
||||
"""Look for files in the registered xstatic.* packages"""
|
||||
if path.startswith(self.storage_class.prefix + '/'):
|
||||
path = path[len(self.storage_class.prefix)+1:]
|
||||
path = path[len(self.storage_class.prefix) + 1 :]
|
||||
matches = []
|
||||
for app, storage in self.storages.items():
|
||||
if storage.exists(path):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var gadjo_js = gadjo_js || {};
|
||||
(function () {
|
||||
if (gadjo_js.loaded) return
|
||||
if (gadjo_js.loaded) return;
|
||||
gadjo_js.loaded = true;
|
||||
var $ = jQuery;
|
||||
var popup_script_loaded = {};
|
||||
|
@ -368,51 +368,62 @@ var gadjo_js = gadjo_js || {};
|
|||
}
|
||||
}
|
||||
|
||||
var cookie_domain = window.location.hostname.split('.').slice(1).join('.');
|
||||
|
||||
function readCookie(name) { /* http://www.quirksmode.org/js/cookies.html */
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function set_sidepage_status(sidepage_status) {
|
||||
storage.sidepage_status = sidepage_status;
|
||||
if (cookie_domain) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (10 * 86400 * 1000)); /* a long week */
|
||||
document.cookie = 'gadjo_sidepage_status=' + sidepage_status +
|
||||
'; expires=' + date.toGMTString() +
|
||||
(window.location.protocol == "https:" && "; Secure" || "") +
|
||||
'; sameSite=Strict' +
|
||||
'; domain=.' + cookie_domain +
|
||||
'; path=/';
|
||||
}
|
||||
}
|
||||
function get_sidepage_status() {
|
||||
if (window.location.protocol == 'file:') {
|
||||
/* don't open sidepage when loading from a file:// */
|
||||
return 'collapsed';
|
||||
}
|
||||
var sidepage_status = null;
|
||||
if (cookie_domain) {
|
||||
sidepage_status = readCookie('gadjo_sidepage_status');
|
||||
} else {
|
||||
sidepage_status = storage.sidepage_status;
|
||||
}
|
||||
if (!sidepage_status &&
|
||||
typeof(GADJO_DEFAULT_SIDEPAGE_STATUS) !== "undefined") {
|
||||
return GADJO_DEFAULT_SIDEPAGE_STATUS;
|
||||
}
|
||||
return sidepage_status;
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
if (document.body.dataset.gadjo === 'true' && document.getElementById('sidepage')) {
|
||||
document.body.setAttribute('data-has-sidepage', 'true');
|
||||
if (storage.gadjo_sidebar_menu) {
|
||||
$('#sidepage-menu').empty().append($(storage.gadjo_sidebar_menu));
|
||||
}
|
||||
if (window.innerWidth > 760 && get_sidepage_status() == 'expanded') {
|
||||
document.body.className += ' sidepage-expanded';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
var cookie_domain = window.location.hostname.split('.').slice(1).join('.');
|
||||
|
||||
function readCookie(name) { /* http://www.quirksmode.org/js/cookies.html */
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function set_sidepage_status(sidepage_status) {
|
||||
storage.sidepage_status = sidepage_status;
|
||||
if (cookie_domain) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (10 * 86400 * 1000)); /* a long week */
|
||||
document.cookie = 'gadjo_sidepage_status=' + sidepage_status +
|
||||
'; expires=' + date.toGMTString() +
|
||||
(window.location.protocol == "https:" && "; Secure" || "") +
|
||||
'; sameSite=Strict' +
|
||||
'; domain=.' + cookie_domain +
|
||||
'; path=/';
|
||||
}
|
||||
}
|
||||
function get_sidepage_status() {
|
||||
if (window.location.protocol == 'file:') {
|
||||
/* don't open sidepage when loading from a file:// */
|
||||
return 'collapsed';
|
||||
}
|
||||
var sidepage_status = null;
|
||||
if (cookie_domain) {
|
||||
sidepage_status = readCookie('gadjo_sidepage_status');
|
||||
} else {
|
||||
sidepage_status = storage.sidepage_status;
|
||||
}
|
||||
if (!sidepage_status &&
|
||||
typeof(GADJO_DEFAULT_SIDEPAGE_STATUS) !== "undefined") {
|
||||
return GADJO_DEFAULT_SIDEPAGE_STATUS;
|
||||
}
|
||||
return sidepage_status;
|
||||
}
|
||||
|
||||
$(document).on('click.gadjo', 'a[rel=popup], a[data-popup]', displayPopup);
|
||||
if ($('#sidepage').length) {
|
||||
var sidepage_button = $('#sidepage #applabel');
|
||||
|
@ -429,11 +440,6 @@ var gadjo_js = gadjo_js || {};
|
|||
$(window).trigger('gadjo:sidepage-toggled');
|
||||
}, 500);
|
||||
});
|
||||
if ($(window).width() > 760) {
|
||||
if (get_sidepage_status() == 'expanded') {
|
||||
$('body').toggleClass('sidepage-expanded');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$(function () { /* foldable elements with memory */
|
||||
|
@ -461,9 +467,6 @@ var gadjo_js = gadjo_js || {};
|
|||
});
|
||||
$(function () {
|
||||
if ($('body').data('gadjo')) {
|
||||
if ($('#sidepage').length == 1) {
|
||||
$('body').attr('data-has-sidepage', 'true');
|
||||
}
|
||||
/* add × to close notification messages */
|
||||
$('.messages > li').each(function(idx, elem) {
|
||||
var elem = $('<a aria-hidden="true" class="close">×</a>');
|
||||
|
@ -489,7 +492,7 @@ var gadjo_js = gadjo_js || {};
|
|||
if (window.getSelection().toString()) {
|
||||
return false;
|
||||
}
|
||||
var href = $(this).find('a[href]').prop('href');
|
||||
var href = $(this).data('url') || $(this).find('a[href]').prop('href');
|
||||
if (href) {
|
||||
if (event.which == 2 || event.ctrlKey) {
|
||||
window.open(href, '_blank');
|
||||
|
@ -517,4 +520,7 @@ var gadjo_js = gadjo_js || {};
|
|||
return false;
|
||||
});
|
||||
});
|
||||
$(document).on('publik:menu-loaded', function() {
|
||||
storage.gadjo_sidebar_menu = document.getElementById('sidepage-menu').innerHTML;
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from collections import OrderedDict
|
||||
import re
|
||||
import time
|
||||
|
||||
from xstatic.main import XStatic
|
||||
from collections import OrderedDict
|
||||
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
|
@ -10,9 +8,11 @@ from django.core.exceptions import ImproperlyConfigured
|
|||
from django.forms import BoundField
|
||||
from django.utils.html import escape
|
||||
from django.utils.http import urlencode
|
||||
from xstatic.main import XStatic
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def xstatic(modname, filename):
|
||||
if settings.DEBUG:
|
||||
|
@ -22,6 +22,7 @@ def xstatic(modname, filename):
|
|||
|
||||
START_TIMESTAMP = time.strftime('%Y%m%d.%H%M')
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def start_timestamp():
|
||||
return START_TIMESTAMP
|
||||
|
@ -30,6 +31,7 @@ def start_timestamp():
|
|||
# {% querystring %} bits originally from django-tables2.
|
||||
kwarg_re = re.compile(r"(?:(.+)=)?(.+)")
|
||||
|
||||
|
||||
def token_kwargs(bits, parser):
|
||||
"""
|
||||
Based on Django's `~django.template.defaulttags.token_kwargs`, but with a
|
||||
|
@ -50,9 +52,10 @@ def token_kwargs(bits, parser):
|
|||
kwargs[parser.compile_filter(key)] = parser.compile_filter(value)
|
||||
return kwargs
|
||||
|
||||
|
||||
class QuerystringNode(template.Node):
|
||||
def __init__(self, updates, removals):
|
||||
super(QuerystringNode, self).__init__()
|
||||
super().__init__()
|
||||
self.updates = updates
|
||||
self.removals = removals
|
||||
|
||||
|
@ -69,6 +72,7 @@ class QuerystringNode(template.Node):
|
|||
params.pop(removal.resolve(context), None)
|
||||
return escape("?" + urlencode(params, doseq=True))
|
||||
|
||||
|
||||
@register.tag
|
||||
def querystring(parser, token):
|
||||
"""
|
||||
|
@ -103,7 +107,7 @@ def with_template(form):
|
|||
widget = field.field.widget
|
||||
templates = ['gadjo/widget.html']
|
||||
if hasattr(widget, 'input_type'):
|
||||
templates.insert(0, 'gadjo/%s-widget.html' % widget.input_type)
|
||||
templates.insert(0, 'gadjo/%s-widget.html' % widget.input_type)
|
||||
fields_with_templates.append(
|
||||
(
|
||||
field,
|
||||
|
|
|
@ -10,6 +10,8 @@ args = sys.argv[1:]
|
|||
if b'Inkscape 0' not in inkscape_version:
|
||||
# --export-png replaced by --export-filename
|
||||
# --without-gui and --file removed
|
||||
args = [x.replace('--export-png', '--export-filename') for x in args if x not in ('--without-gui', '--file')]
|
||||
args = [
|
||||
x.replace('--export-png', '--export-filename') for x in args if x not in ('--without-gui', '--file')
|
||||
]
|
||||
|
||||
sys.exit(subprocess.call(['inkscape'] + args))
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
[MASTER]
|
||||
persistent=yes
|
||||
ignore=vendor,Bouncers,ezt.py
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=
|
||||
abstract-method,
|
||||
arguments-differ,
|
||||
attribute-defined-outside-init,
|
||||
bad-super-call,
|
||||
consider-using-f-string,
|
||||
consider-using-set-comprehension,
|
||||
consider-using-ternary,
|
||||
cyclic-import,
|
||||
duplicate-code,
|
||||
exec-used,
|
||||
fixme,
|
||||
import-outside-toplevel,
|
||||
inconsistent-return-statements,
|
||||
invalid-name,
|
||||
invalid-str-returned,
|
||||
keyword-arg-before-vararg,
|
||||
missing-class-docstring,
|
||||
missing-function-docstring,
|
||||
missing-module-docstring,
|
||||
no-else-return,
|
||||
no-member,
|
||||
not-an-iterable,
|
||||
protected-access,
|
||||
raise-missing-from,
|
||||
redefined-argument-from-local,
|
||||
redefined-builtin,
|
||||
redefined-outer-name,
|
||||
superfluous-parens,
|
||||
too-many-ancestors,
|
||||
too-many-branches,
|
||||
too-many-instance-attributes,
|
||||
too-many-lines,
|
||||
too-many-locals,
|
||||
too-many-nested-blocks,
|
||||
too-many-return-statements,
|
||||
too-many-statements,
|
||||
undefined-loop-variable,
|
||||
unnecessary-lambda-assignment,
|
||||
unspecified-encoding,
|
||||
unsubscriptable-object,
|
||||
unsupported-assignment-operation,
|
||||
unsupported-membership-test,
|
||||
unused-argument,
|
||||
use-a-generator,
|
||||
use-implicit-booleaness-not-comparison
|
||||
|
||||
|
||||
[REPORTS]
|
||||
output-format=parseable
|
||||
|
||||
|
||||
[BASIC]
|
||||
no-docstring-rgx=__.*__|_.*
|
||||
class-rgx=[A-Z_][a-zA-Z0-9_]+$
|
||||
function-rgx=[a-zA_][a-zA-Z0-9_]{2,70}$
|
||||
method-rgx=[a-z_][a-zA-Z0-9_]{2,70}$
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|([a-z_][a-z0-9_]*)|(__.*__)|register|urlpatterns)$
|
||||
good-names=_,i,j,k,e,x,Run,,setUp,tearDown,r,p,s,v,fd
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# List of classes names for which member attributes should not be checked
|
||||
# (useful for classes with attributes dynamically set).
|
||||
ignored-classes=SQLObject,WSGIRequest,Publisher,NullSessionManager
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E0201 when accessed.
|
||||
generated-members=objects,DoesNotExist,id,pk,_meta,base_fields,context
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes
|
||||
defining-attr-methods=__init__,__new__,setUp
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
init-import=no
|
||||
dummy-variables-rgx=_|dummy
|
||||
additional-builtins=_,N_,ngettext
|
||||
good-names=_,i,j,k,e,x,Run,,setUp,tearDown,r,p,s,v,fd
|
||||
|
||||
[SIMILARITIES]
|
||||
min-similarity-lines=6
|
||||
ignore-comments=yes
|
||||
ignore-docstrings=yes
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
notes=FIXME,XXX,TODO
|
||||
|
||||
|
||||
[FORMAT]
|
||||
max-line-length=160
|
||||
max-module-lines=2000
|
||||
indent-string=' '
|
||||
|
||||
|
||||
[DESIGN]
|
||||
max-args=10
|
||||
max-locals=15
|
||||
max-returns=6
|
||||
max-branches=12
|
||||
max-statements=50
|
||||
max-parents=7
|
||||
max-attributes=7
|
||||
min-public-methods=0
|
||||
max-public-methods=50
|
|
@ -0,0 +1,5 @@
|
|||
#! /bin/bash
|
||||
set -e -x
|
||||
env
|
||||
|
||||
pylint -f parseable --rcfile pylint.rc "$@" | tee pylint.out || /bin/true
|
94
setup.py
94
setup.py
|
@ -1,26 +1,25 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from distutils.cmd import Command
|
||||
from distutils.errors import CompileError
|
||||
from distutils.spawn import find_executable
|
||||
from setuptools.command.install_lib import install_lib as _install_lib
|
||||
from distutils.command.build import build as _build
|
||||
from distutils.command.sdist import sdist
|
||||
from setuptools import setup, find_packages
|
||||
from distutils.errors import CompileError
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools.command.install_lib import install_lib as _install_lib
|
||||
|
||||
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
||||
|
||||
class eo_sdist(sdist):
|
||||
|
||||
class eo_sdist(sdist):
|
||||
def run(self):
|
||||
print("creating VERSION file")
|
||||
if os.path.exists('VERSION'):
|
||||
|
@ -34,29 +33,31 @@ class eo_sdist(sdist):
|
|||
if os.path.exists('VERSION'):
|
||||
os.remove('VERSION')
|
||||
|
||||
|
||||
def get_version():
|
||||
'''Use the VERSION, if absent generates a version with git describe, if not
|
||||
tag exists, take 0.0- and add the length of the commit log.
|
||||
tag exists, take 0.0- and add the length of the commit log.
|
||||
'''
|
||||
if os.path.exists('VERSION'):
|
||||
with open('VERSION', 'r') as v:
|
||||
with open('VERSION') as v:
|
||||
return v.read()
|
||||
if os.path.exists('.git'):
|
||||
p = subprocess.Popen(['git','describe','--dirty=.dirty','--match=v*'],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(
|
||||
['git', 'describe', '--dirty=.dirty', '--match=v*'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
result = p.communicate()[0]
|
||||
if p.returncode == 0:
|
||||
result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v
|
||||
if '-' in result: # not a tagged version
|
||||
result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v
|
||||
if '-' in result: # not a tagged version
|
||||
real_number, commit_count, commit_hash = result.split('-', 2)
|
||||
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
|
||||
else:
|
||||
version = result
|
||||
return version
|
||||
else:
|
||||
return '0.0.post%s' % len(
|
||||
subprocess.check_output(
|
||||
['git', 'rev-list', 'HEAD']).splitlines())
|
||||
return '0.0.post%s' % len(subprocess.check_output(['git', 'rev-list', 'HEAD']).splitlines())
|
||||
return '0.0'
|
||||
|
||||
|
||||
|
@ -74,6 +75,7 @@ class compile_translations(Command):
|
|||
curdir = os.getcwd()
|
||||
try:
|
||||
from django.core.management import call_command
|
||||
|
||||
for path, dirs, files in os.walk('gadjo'):
|
||||
if 'locale' not in dirs:
|
||||
continue
|
||||
|
@ -103,7 +105,9 @@ class compile_scss(Command):
|
|||
if sass_bin:
|
||||
break
|
||||
if not sass_bin:
|
||||
raise CompileError('A sass compiler is required but none was found. See sass-lang.com for choices.')
|
||||
raise CompileError(
|
||||
'A sass compiler is required but none was found. See sass-lang.com for choices.'
|
||||
)
|
||||
|
||||
for package in self.distribution.packages:
|
||||
for package_path in __import__(package).__path__:
|
||||
|
@ -113,10 +117,14 @@ class compile_scss(Command):
|
|||
continue
|
||||
if filename.startswith('_'):
|
||||
continue
|
||||
subprocess.check_call([sass_bin, '%s/%s' % (path, filename),
|
||||
'%s/%s' % (path, filename.replace('.scss', '.css'))],
|
||||
env={'LC_ALL': 'C.UTF-8'}
|
||||
)
|
||||
subprocess.check_call(
|
||||
[
|
||||
sass_bin,
|
||||
'%s/%s' % (path, filename),
|
||||
'%s/%s' % (path, filename.replace('.scss', '.css')),
|
||||
],
|
||||
env={'LC_ALL': 'C.UTF-8'},
|
||||
)
|
||||
|
||||
|
||||
class build_icons(Command):
|
||||
|
@ -157,15 +165,14 @@ class build_icons(Command):
|
|||
for variant in variants:
|
||||
dest_filename = '%s.%s.png' % (basename, variant)
|
||||
destname = os.path.join(destpath, dest_filename)
|
||||
self.generate(os.path.join(basepath, filename), destname,
|
||||
**variants.get(variant))
|
||||
self.generate(os.path.join(basepath, filename), destname, **variants.get(variant))
|
||||
|
||||
def generate(self, src, dest, colour, width, **kwargs):
|
||||
if os.path.exists(dest) and os.stat(dest).st_mtime >= os.stat(src).st_mtime:
|
||||
return
|
||||
# default values
|
||||
from PIL import Image
|
||||
from PIL import PngImagePlugin
|
||||
from PIL import Image, PngImagePlugin
|
||||
|
||||
license = 'Creative Commons Attribution-Share Alike 3.0'
|
||||
if 'old-set' in src:
|
||||
author = 'GNOME Project'
|
||||
|
@ -183,12 +190,20 @@ class build_icons(Command):
|
|||
f.write(ET.tostring(tree))
|
||||
f.close()
|
||||
|
||||
subprocess.call([inkscape, '--without-gui',
|
||||
'--file', f.name,
|
||||
'--export-area-drawing',
|
||||
'--export-area-snap',
|
||||
'--export-png', dest,
|
||||
'--export-width', width])
|
||||
subprocess.call(
|
||||
[
|
||||
inkscape,
|
||||
'--without-gui',
|
||||
'--file',
|
||||
f.name,
|
||||
'--export-area-drawing',
|
||||
'--export-area-snap',
|
||||
'--export-png',
|
||||
dest,
|
||||
'--export-width',
|
||||
width,
|
||||
]
|
||||
)
|
||||
|
||||
# write down licensing info in the png file
|
||||
meta = PngImagePlugin.PngInfo()
|
||||
|
@ -198,9 +213,11 @@ class build_icons(Command):
|
|||
|
||||
|
||||
class build(_build):
|
||||
sub_commands = [('compile_translations', None),
|
||||
('compile_scss', None),
|
||||
('build_icons', None)] + _build.sub_commands
|
||||
sub_commands = [
|
||||
('compile_translations', None),
|
||||
('compile_scss', None),
|
||||
('build_icons', None),
|
||||
] + _build.sub_commands
|
||||
|
||||
|
||||
class install_lib(_install_lib):
|
||||
|
@ -208,6 +225,7 @@ class install_lib(_install_lib):
|
|||
self.run_command('compile_translations')
|
||||
_install_lib.run(self)
|
||||
|
||||
|
||||
setup(
|
||||
name='gadjo',
|
||||
version=get_version(),
|
||||
|
@ -224,7 +242,7 @@ setup(
|
|||
'XStatic_jQuery',
|
||||
'XStatic_jquery_ui',
|
||||
'XStatic_OpenSans',
|
||||
],
|
||||
],
|
||||
setup_requires=[
|
||||
'Pillow',
|
||||
],
|
||||
|
@ -245,6 +263,6 @@ setup(
|
|||
'compile_scss': compile_scss,
|
||||
'compile_translations': compile_translations,
|
||||
'install_lib': install_lib,
|
||||
'sdist': eo_sdist
|
||||
'sdist': eo_sdist,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
[tox]
|
||||
envlist = codestyle-pylint
|
||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/scrutiny/{env:BRANCH_NAME:}
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
codestyle: pre-commit
|
||||
pylint: pylint
|
||||
pylint: pylint-django
|
||||
commands =
|
||||
codestyle: pre-commit run --all-files --show-diff-on-failure
|
||||
pylint: ./pylint.sh gadjo/
|
Loading…
Reference in New Issue