diff --git a/.travis.yml b/.travis.yml index 86d205d3..c245a73f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +# We need to use Ubuntu 16.04 (Xenial Xerus) to get Python 3.7 +dist: xenial + language: python services: @@ -5,63 +8,69 @@ services: addons: postgresql: "9.6" - apt: - packages: - - postgresql-9.6-postgis-2.3 + # https://gis.stackexchange.com/a/252610 + # apt: + # packages: + # - postgresql-9.6-postgis-2.3 python: - "2.7" - - "3.3" - "3.4" - "3.5" - "3.6" + - "3.7" env: - - DJANGO_VERSION='Django>=1.7,<1.8' - DJANGO_VERSION='Django>=1.8,<1.9' - DJANGO_VERSION='Django>=1.9,<1.10' - DJANGO_VERSION='Django>=1.10,<1.11' - DJANGO_VERSION='Django>=1.11,<2.0' - DJANGO_VERSION='Django>=2.0,<2.1' + - DJANGO_VERSION='Django>=2.1,<2.2' - DJANGO_VERSION='https://github.com/django/django/archive/master.tar.gz' matrix: exclude: - - python: "3.5" - env: DJANGO_VERSION='Django>=1.7,<1.8' - - python: "3.6" - env: DJANGO_VERSION='Django>=1.7,<1.8' - - python: "3.3" - env: DJANGO_VERSION='Django>=1.9,<1.10' - - python: "3.3" - env: DJANGO_VERSION='Django>=1.10,<1.11' - - python: "3.3" - env: DJANGO_VERSION='Django>=1.11,<2.0' - python: "2.7" env: DJANGO_VERSION='Django>=2.0,<2.1' - - python: "3.3" - env: DJANGO_VERSION='Django>=2.0,<2.1' - python: "2.7" - env: DJANGO_VERSION='https://github.com/django/django/archive/master.tar.gz' - - python: "3.3" + env: DJANGO_VERSION='Django>=2.1,<2.2' + - python: "3.4" + env: DJANGO_VERSION='Django>=2.1,<2.2' + - python: "2.7" env: DJANGO_VERSION='https://github.com/django/django/archive/master.tar.gz' - python: "3.4" env: DJANGO_VERSION='https://github.com/django/django/archive/master.tar.gz' allow_failures: - - env: DJANGO_VERSION='Django>=1.7,<1.8' - python: "3.6" env: DJANGO_VERSION='Django>=1.8,<1.9' + - python: "3.7" + env: DJANGO_VERSION='Django>=1.8,<1.9' + - python: "3.6" + env: DJANGO_VERSION='Django>=1.9,<1.10' + - python: "3.7" + env: DJANGO_VERSION='Django>=1.9,<1.10' + - python: "3.6" + env: DJANGO_VERSION='Django>=1.10,<1.11' + - python: "3.7" + env: DJANGO_VERSION='Django>=1.10,<1.11' - env: DJANGO_VERSION='https://github.com/django/django/archive/master.tar.gz' +before_install: + # https://gis.stackexchange.com/a/252610 + - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/postgresql.list' + - sudo apt-get install --yes postgresql-9.6-postgis-2.4 + install: - pip install -q $DJANGO_VERSION - pip install -q django-model-utils flake8 psycopg2 six swapper tox tqdm before_script: - - psql -U postgres -c "CREATE EXTENSION postgis;" + # - psql -U postgres -c "CREATE EXTENSION postgis;" - psql -c 'create database django_cities;' -U postgres - psql -U postgres -c 'CREATE EXTENSION postgis;' -d django_cities script: - - flake8 --ignore=E501 + - flake8 - PYTHONPATH=. python test_project/manage.py test test_app --noinput diff --git a/README.md b/README.md index b38de1ef..ff34dc46 100644 --- a/README.md +++ b/README.md @@ -12,22 +12,23 @@ django-cities provides you with place related models (eg. Country, Region, City) This package officially supports all currently supported versions of Python/Django: -| Python | 2.7 | 3.3 | 3.4 | 3.5 | 3.6 | -| :------------ | --- | --- | --- | --- | --- | -| Django 1.7 | :x: | :x: | :x: | :x: | :x: | -| Django 1.8 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :large_blue_circle: | -| Django 1.9 | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :large_blue_circle: | -| Django 1.10 | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :large_blue_circle: | -| Django 1.11 | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Django 2.0 | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Django [master](https://github.com/django/django/archive/master.tar.gz) | :x: | :x: | :x: | :x: | :x: | - -| Key | | -| :-: | :------------------------------------------------------------------ | -| :white_check_mark: | Officially supported, tested, and passing | -| :large_blue_circle: | Tested and passing, but not officially supported | -| :white_square_button: | Not officially supported, may break at any time, most tests passing | -| :x: | Known incompatibilities | +| Python | 2.7 | 3.4 | 3.5 | 3.6 | 3.7 | +| :------------ | ------------------ | ------------------- | ------------------ | ------------------- | --------------------- | +| Django 1.7 | :x: | :x: | :x: | :x: | :x: | +| Django 1.8 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :large_blue_circle: | :large_blue_circle: | +| Django 1.9 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :large_blue_circle: | :large_blue_circle: | +| Django 1.10 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :large_blue_circle: | :large_blue_circle: | +| Django 1.11 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Django 2.0 | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Django 2.1 | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | + + + +| Key | | +| :-------------------: | :------------------------------------------------------------------ | +| :white_check_mark: | Officially supported, tested, and passing | +| :large_blue_circle: | Tested and passing, but not officially supported | +| :x: | Known incompatibilities | Authored by [Ben Dowling](http://www.coderholic.com), and some great [contributors](https://github.com/coderholic/django-cities/contributors). diff --git a/cities/management/commands/cities.py b/cities/management/commands/cities.py index d50a4a54..f4c85d13 100644 --- a/cities/management/commands/cities.py +++ b/cities/management/commands/cities.py @@ -118,7 +118,7 @@ def add_arguments(self, parser): metavar="DATA_TYPES", default='all', dest="import", - help='Selectively import data. Comma separated list of data ' + + help='Selectively import data. Comma separated list of data ' 'types: ' + str(import_opts).replace("'", '') ) parser.add_argument( @@ -752,7 +752,7 @@ def import_alt_name(self): geo_info['type'].__name__, item['name'])) continue - alt.is_historic = True if ((item['isHistoric']and + alt.is_historic = True if ((item['isHistoric'] and item['isHistoric'] != '\n') or locale == 'fr_1793') else False @@ -789,8 +789,8 @@ def import_alt_name(self): continue if hasattr(alt, 'kind'): - if (locale in ('abbr', 'link', 'name') or - INCLUDE_AIRPORT_CODES and locale in ('iana', 'icao', 'faac')): + if locale in ('abbr', 'link', 'name') or \ + INCLUDE_AIRPORT_CODES and locale in ('iana', 'icao', 'faac'): alt.kind = locale elif locale not in settings.locales and 'all' not in settings.locales: self.logger.debug("Unknown alternative name type: {} -- skipping".format(locale)) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..34bde0f8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[flake8] +ignore = W504,E501 +exclude = build,dist