Skip to content

Commit

Permalink
Merge 06c36dc into 5888540
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Nov 14, 2020
2 parents 5888540 + 06c36dc commit eb2b08e
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 24 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Expand Up @@ -3,7 +3,7 @@
exclude: "(.idea|node_modules|.tox)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v3.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -17,15 +17,15 @@ repos:
args:
- --remove
- repo: https://github.com/timothycrosley/isort
rev: "5.0.2"
rev: "5.6.4"
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -40,14 +40,14 @@ repos:
- flake8-tidy-imports
- pep8-naming
- repo: https://github.com/econchick/interrogate
rev: 1.2.0
rev: 1.3.2
hooks:
- id: interrogate
args:
- "-cpyproject.toml"
- "--quiet"
- repo: https://github.com/asottile/pyupgrade
rev: v2.6.2
rev: v2.7.4
hooks:
- id: pyupgrade
args:
Expand Down
1 change: 1 addition & 0 deletions changes/377.feature
@@ -0,0 +1 @@
Update pre-commit repos
32 changes: 27 additions & 5 deletions djangocms_installer/config/__init__.py
Expand Up @@ -157,7 +157,11 @@ def parse(args):
help="Use Bootstrap 4 Theme",
)
parser.add_argument(
"--templates", dest="templates", action="store", default="no", help="Use custom template set",
"--templates",
dest="templates",
action="store",
default="no",
help="Use custom template set",
)
parser.add_argument(
"--starting-page",
Expand Down Expand Up @@ -202,7 +206,12 @@ def parse(args):
help="Don't run the configuration wizard, just use the " "provided values",
)
parser.add_argument(
"--wizard", "-w", dest="wizard", action="store_true", default=False, help="Run the configuration wizard",
"--wizard",
"-w",
dest="wizard",
action="store_true",
default=False,
help="Run the configuration wizard",
)
parser.add_argument(
"--verbose",
Expand Down Expand Up @@ -236,7 +245,11 @@ def parse(args):
help="Don't install package dependencies",
)
parser.add_argument(
"--no-plugins", dest="no_plugins", action="store_true", default=False, help="Don't install plugins",
"--no-plugins",
dest="no_plugins",
action="store_true",
default=False,
help="Don't install plugins",
)
parser.add_argument(
"--no-db-driver",
Expand All @@ -254,7 +267,12 @@ def parse(args):
help="Don't run syncdb / migrate after bootstrapping",
)
parser.add_argument(
"--no-user", "-u", dest="no_user", action="store_true", default=False, help="Don't create the admin user",
"--no-user",
"-u",
dest="no_user",
action="store_true",
default=False,
help="Don't create the admin user",
)
parser.add_argument(
"--template",
Expand Down Expand Up @@ -287,7 +305,11 @@ def parse(args):
help="Delete project directory on creation failure.",
)
parser.add_argument(
"--utc", dest="utc", action="store_true", default=False, help="Use UTC timezone.",
"--utc",
dest="utc",
action="store_true",
default=False,
help="Use UTC timezone.",
)

if "--utc" in args:
Expand Down
9 changes: 6 additions & 3 deletions djangocms_installer/django/__init__.py
Expand Up @@ -175,7 +175,8 @@ def patch_settings(config_data):

if config_data.languages:
original = original.replace(
"LANGUAGE_CODE = 'en-us'", "LANGUAGE_CODE = '{}'".format(config_data.languages[0]),
"LANGUAGE_CODE = 'en-us'",
"LANGUAGE_CODE = '{}'".format(config_data.languages[0]),
)
if config_data.timezone:
original = original.replace("TIME_ZONE = 'UTC'", "TIME_ZONE = '{}'".format(config_data.timezone))
Expand Down Expand Up @@ -229,7 +230,8 @@ def _build_settings(config_data):

text.append(
"MIDDLEWARE = [\n{}{}\n]".format(
spacer, (",\n" + spacer).join(["'{}'".format(var) for var in settings_data.MIDDLEWARE_CLASSES]),
spacer,
(",\n" + spacer).join(["'{}'".format(var) for var in settings_data.MIDDLEWARE_CLASSES]),
)
)

Expand Down Expand Up @@ -323,7 +325,8 @@ def _build_settings(config_data):
if config_data.filer:
text.append(
"THUMBNAIL_PROCESSORS = (\n{}{}\n)".format(
spacer, (",\n" + spacer).join(["'{}'".format(var) for var in settings_data.THUMBNAIL_PROCESSORS]),
spacer,
(",\n" + spacer).join(["'{}'".format(var) for var in settings_data.THUMBNAIL_PROCESSORS]),
)
)
return "\n\n".join(text)
Expand Down
9 changes: 7 additions & 2 deletions djangocms_installer/main.py
Expand Up @@ -24,11 +24,16 @@ def execute():
if not config_data.no_deps:
if config_data.requirements_file:
install.requirements(
config_data.requirements_file, config_data.pip_options, True, verbose=config_data.verbose,
config_data.requirements_file,
config_data.pip_options,
True,
verbose=config_data.verbose,
)
else:
install.requirements(
config_data.requirements, config_data.pip_options, verbose=config_data.verbose,
config_data.requirements,
config_data.pip_options,
verbose=config_data.verbose,
)
sys.stdout.write("Dependencies installed\nCreating the project\n")
install.check_install(config_data)
Expand Down
18 changes: 16 additions & 2 deletions docs/conf.py
Expand Up @@ -199,7 +199,13 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
("index", "djangocms_installer.tex", "django CMS Installer Documentation", "Iacopo Spalletti", "manual",),
(
"index",
"djangocms_installer.tex",
"django CMS Installer Documentation",
"Iacopo Spalletti",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -227,7 +233,15 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "djangocms_installer", "django CMS Installer Documentation", ["Iacopo Spalletti"], 1,)]
man_pages = [
(
"index",
"djangocms_installer",
"django CMS Installer Documentation",
["Iacopo Spalletti"],
1,
)
]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 119
target-version = ["py27"]
target-version = ["py36"]
include = 'app_helper/*py'

[tool.towncrier]
Expand Down
10 changes: 9 additions & 1 deletion tests/config.py
Expand Up @@ -949,7 +949,15 @@ def test_parse_config_file(self, *args):
("django_version", dj_lts_version),
),
),
("config-03.ini", None, (("cms_version", "3.8"), ("i18n", "no"), ("django_version", dj_version),)),
(
"config-03.ini",
None,
(
("cms_version", "3.8"),
("i18n", "no"),
("django_version", dj_version),
),
),
("config-04.ini", None, (("cms_version", "3.8"), ("use_timezone", "no"))),
("config-05.ini", None, (("cms_version", "3.8"), ("timezone", "Europe/London"))),
("config-06.ini", None, (("cms_version", "3.8"), ("reversion", "no"))),
Expand Down
9 changes: 6 additions & 3 deletions tests/django.py
Expand Up @@ -180,7 +180,8 @@ def test_patch_22_settings(self):

# checking for django options
self.assertEqual(
project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, "media"),
project.settings.MEDIA_ROOT,
os.path.join(config_data.project_directory, "media"),
)
self.assertEqual(project.settings.MEDIA_URL, "/media/")

Expand Down Expand Up @@ -222,7 +223,8 @@ def test_patch_django_22_37(self):

# checking for django options
self.assertEqual(
project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, "media"),
project.settings.MEDIA_ROOT,
os.path.join(config_data.project_directory, "media"),
)
self.assertEqual(project.settings.MEDIA_URL, "/media/")

Expand Down Expand Up @@ -482,7 +484,8 @@ def test_patch(self):
self.assertEqual(project.settings.TIME_ZONE, "Europe/Moscow")
self.assertEqual(project.settings.LANGUAGE_CODE, "en")
self.assertTrue(
project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, "media"),
project.settings.MEDIA_ROOT,
os.path.join(config_data.project_directory, "media"),
)
self.assertEqual(project.settings.MEDIA_URL, "/media/")
#
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -53,7 +53,7 @@ skip_install = true
[testenv:isort]
commands =
{envpython} -m isort -c --df djangocms_installer tests
deps = isort>5,<5.1
deps = isort>5,<6
recreate = False
skip_install = true

Expand Down

0 comments on commit eb2b08e

Please sign in to comment.