Commit Graph

18 Commits

Author SHA1 Message Date
DjLegolas 0ed3554f95 [WebUI] Copy non-minified JS file if slimit missing
This will remove the setup dependency in "slimit" package.
In case "slimit" is missing, the non-minified JS files will be copied
as is to the build.
"slimit" is marked as a dependency for development process only.
2018-10-08 12:13:21 +01:00
Calum Lind b1cdc32f73 [Lint] Use Black to auto-format code
The move to using auto-formatter makes it easier to read, submit and
speeds up development time. https://github.com/ambv/black/

Although I would prefer 79 chars, the default line length of 88 chars
used by black suffices. The flake8 line length remains at 120 chars
since black does not touch comments or docstrings and this will require
another round of fixes.

The only black setting that is not standard is the use of double-quotes
for strings so disabled any formatting of these. Note however that
flake8 will still flag usage of double-quotes. I may change my mind on
double vs single quotes but for now leave them.

A new pyproject.toml file has been created for black configuration.
2018-10-03 15:21:53 +01:00
Calum Lind 84802da29b [Py2to3] Force unicode_literals and fix related issues
* Added `from __future__ import unicode_literals` to every file so
   now all strings in code are forced to be unicode strings unless
   marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.

   This is a large change but we have been working towards the goal of unicode
   strings passed in the code so decoding external input and encoding
   output as byte strings (where applicable).

   Note that in Python 2 the `str` type still refers to byte strings.

 * Replaced the use of `str` for `basestring` in isinstance comparison as
   this was the original intention but breaks code when encoutering unicode strings.

 * Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
   related to gobject signal names.
2017-02-22 12:36:32 +00:00
Calum Lind 5f4a16630e Fix a typo in minify script 2016-11-28 19:20:05 +00:00
Calum Lind a48c01c3a5 Cleanup up minify js script
- The slimit package is now widely available so make the script
   only rely on it and closure. Keeping closure as it makes the most
   compact and lints the javascript but it is not as easy to install
   as slimit.
2016-11-28 12:59:03 +00:00
Calum Lind 36cbfa8c61 [Lint] Fix files to pass Flake8 v3.2.0 2016-11-17 12:19:41 +00:00
Calum Lind cea50f319d [WebUI] Print error if minify script encounters error with closure 2016-05-19 15:47:15 +01:00
Calum Lind d280fa9fbd [Lint] Cleanup helper scripts to pass PyLint 2015-10-30 18:39:52 +00:00
Calum Lind 32bc20d8ce Fix pep8 across codebase
* Further whitespace fixes by autopep8
 * Using pep8 v1.6.2 (not currently used by pyflakes)
 * Update config for pep8 and flake8 in tox.ini
   * A separate pep8 entry for running autopep8. The ignores prevent
     blank lines being added after docstrings.
   * .tox and E133 are ignored in flake8 by default.
2015-10-21 00:06:27 +01:00
Calum Lind d898ba9333 [WebUI] Refactor server.get_scripts
* The directory list is now sorted so will always produce the same output.
 * Code is now shared with minify script, with some minor changes.
2015-09-04 15:02:19 +01:00
Calum Lind a3073c44e2 Update minify script to use closure 2015-08-25 16:18:02 +01:00
Calum Lind 7d679eb480 Updates to helper scripts
* Python 3 compatible
 * Consistent quote symbol
2015-08-25 15:43:55 +01:00
Calum Lind d7029dcfc6 [WebUI] Improve the minify script 2015-08-22 14:27:17 +01:00
Calum Lind 6020809462 Minor cleanup of minify js script 2015-08-14 00:17:48 +01:00
Calum Lind 8c4154bc1a Fix the output of minify js script
The order of the js files matters when minifying.

 * Use the '.order' files to put specified files top of the file list.
 * Sub-directory files inserted in list before root directory files.
 * Sort everything else alphabetically for consistant ordering.
2015-08-13 23:04:01 +01:00
Calum Lind f2d81ff542 Update headers and isort imports 2014-09-23 08:39:29 +01:00
Calum Lind 20b05ae595 Remove unneeded ez_setup and 'isort' imports 2014-09-04 00:37:57 +01:00
Calum Lind 98b54e6682 Rewrite the webui minify js script in python
Also replaced minifier 'yui-compressor' with pure-python 'slimit'.
2014-07-10 15:05:52 +01:00