Commit Graph

13 Commits

Author SHA1 Message Date
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 5e1603317a Revert "Rename version.py to calc_version.py to fix buildd error"
This reverts commit 943a9ded00.
2016-11-26 19:35:53 +00:00
Calum Lind 943a9ded00 Rename version.py to calc_version.py to fix buildd error
- There is a version.py included with buildd that is conflicting
   with the deluge one. Rather than messing with sys.path it is
   simplest to rename version.py to calc_version.py
2016-11-26 17:51:07 +00:00
Calum Lind 3a2ff0c188 [Lint] Convert all python double quotes to single quotes
* A rather disruptive change but for a few reasons such as easier to read,
   easier type, keep consistent and javascript code uses single quotes.
 * There are a few exceptions for the automated process:
    * Any double quotes in comments
    * Triple double quotes for docstrings
    * Strings containing single quotes are left e.g. "they're"

 * To deal with merge conflicts from feature branches it is best to follow
   these steps for each commit:
     * Create a patch: `git format-patch -1 <sha1>`
     * Edit the patch and replace double quotes with single except those in
       comments or strings containing an unescaped apostrophe.
     * Check the patch `git apply --check <patchfile>` and fix any remaining
       issues if it outputs an error.
     * Apply the patch `git am < <patchfile>`
2016-11-03 21:45:45 +00:00
Calum Lind d280fa9fbd [Lint] Cleanup helper scripts to pass PyLint 2015-10-30 18:39:52 +00:00
Calum Lind 7d679eb480 Updates to helper scripts
* Python 3 compatible
 * Consistent quote symbol
2015-08-25 15:43:55 +01:00
Calum Lind 24b71a400f [WebUI] Improve the gen_web_gettext script
* Create a 'minified' gettext.js by removing comments from file and simplifying js code.
 * Added creating the file to generate_pot.py, so it is not forgotten about.
2015-08-22 14:26:56 +01:00
Calum Lind 90db2b4c5c Minor updates to the translation scripts
* General cleanup of code.
 * Add commandline folder option to js gettext script.
 * Include webui render html files to pot template creation.
2015-08-20 18:51:09 +01:00
Calum Lind a391bbd67b Workaround for js files generating warnings with generate_pot script
With xgettext set to python it will parse the comments in javascript files, so
single apostrophes or quotes are flagged as 'warning: untermined string'.

This change just rewrites js comments to not use apostrophes.
2015-08-13 23:04:00 +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 5167e93d12 Flake8 core and common files
* Added N802 to flake8 ignore as certain inherited funcs cannot be changed
   to lowercase and this unresolved warning hides other errors/warnings.
 * Include new header
2014-09-03 23:48:34 +01:00
Calum Lind d455d03608 Create new generate_pot.py script for translations
* glade3 files require workaround with intltool-extract
 * webui javascript files are now included
 * fix multiline string for parse
2013-05-02 19:21:46 +01:00