Skip to content

Commit

Permalink
more CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Nov 17, 2019
1 parent e2be3e8 commit 1a46139
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 39 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# We set the language to c because python isn't supported on the MacOS X nodes
# on Travis. However, the language ends up being irrelevant anyway, since we
# install Python ourselves using conda.
language: c

os:
- linux

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

env:
matrix:
- PYTHON_VERSION=3.6 SPHINX_VERSION=2.0
- PYTHON_VERSION=3.6 SPHINX_VERSION=2.1
- PYTHON_VERSION=3.6 SPHINX_VERSION=2.2

- PYTHON_VERSION=3.7 SPHINX_VERSION=2.0
- PYTHON_VERSION=3.7 SPHINX_VERSION=2.1
- PYTHON_VERSION=3.7 SPHINX_VERSION=2.2

global:
- LOCALE=default
Expand Down
19 changes: 10 additions & 9 deletions ablog/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import re
import datetime as dtmod
from datetime import datetime
from urlparse import urljoin
from unicodedata import normalize
from urllib.parse import urljoin
from collections.abc import Container

from docutils import nodes
Expand All @@ -25,7 +25,7 @@ def slugify(string):
Slugify *s*.
"""

string = normalize("NFKD", string)
string = normalize("NFKD", str(string))
string = re.sub(r"[^\w\s-]", "", string).strip().lower()
return re.sub(r"[-\s]+", "-", string)

Expand Down Expand Up @@ -108,11 +108,12 @@ def verify_fn(key, value, config):
("blog_default_location", None, True, require_config_str_or_list_lookup("blog_locations")),
("blog_languages", {}, True, require_config_full_name_link_dict()),
("blog_default_language", None, True, require_config_str_or_list_lookup("blog_languages")),
("fontawesome_link_cdn", False, True, require_config_type(str)),
("fontawesome_link_cdn", None, True),
("fontawesome_included", False, True, require_config_type(bool)),
("fontawesome_css_file", "", True, require_config_type(str)),
("post_date_format", "%d %B %Y", True),
("post_date_format_short", "%d %B", True),
("post_date_format", "%d %B %Y", True, require_config_type(str)),
("post_date_format_short", "%d %B", True, require_config_type(str)),
("post_auto_orphan", True, True, require_config_type(bool)),
("post_auto_image", 0, True),
("post_auto_excerpt", 1, True),
("post_redirect_refresh", 5, True),
Expand Down Expand Up @@ -350,7 +351,7 @@ def __str__(self):

def __repr__(self):

return str(self) + " <" + text_type(self.docname) + ">"
return str(self) + " <" + str(self.docname) + ">"

@property
def blog(self):
Expand Down Expand Up @@ -521,7 +522,7 @@ def __init__(self, blog, name, xref, path, reverse=False):

def __str__(self):

return text_type(self.name)
return str(self.name)

def __getitem__(self, name):

Expand Down Expand Up @@ -599,7 +600,7 @@ def __init__(self, catalog, label, name=None, href=None, path=None, page=0):

def __str__(self):

return text_type(self.name)
return str(self.name)

def __len__(self):

Expand All @@ -611,7 +612,7 @@ def __nonzero__(self):

def __unicode__(self):

return text_type(self.name)
return str(self.name)

def __iter__(self):

Expand Down
28 changes: 10 additions & 18 deletions ablog/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from http import server

from invoke import run
from watchdog.observers import Observer
from watchdog.tricks import ShellCommandTrick

import ablog

Expand Down Expand Up @@ -288,10 +290,6 @@ def ablog_serve(website=None, port=8000, view=True, rebuild=False, patterns="*.r

if rebuild:

# from watchdog.watchmedo import observe_with
from watchdog.observers import Observer
from watchdog.tricks import ShellCommandTrick

patterns = patterns.split(";")
ignore_patterns = [os.path.join(website, "*")]
handler = ShellCommandTrick(
Expand Down Expand Up @@ -368,12 +366,7 @@ def ablog_post(filename, title=None, **kwargs):
type=str,
help="environment variable name storing GitHub access token",
)
@arg(
"--github-ssh",
dest="github_is_http",
action="store_true",
help="use ssh when cloning website",
)
@arg("--github-ssh", dest="github_is_http", action="store_true", help="use ssh when cloning website")
@arg(
"--push-quietly",
dest="push_quietly",
Expand Down Expand Up @@ -436,10 +429,9 @@ def ablog_deploy(
run("git pull", echo=True)
else:
run(
"git clone " + ("https://github.com/" if github_is_http else "[email protected]:") +
"{0}/{0}.github.io.git {1}".format(
github_pages, repodir
),
"git clone "
+ ("https://github.com/" if github_is_http else "[email protected]:")
+ "{0}/{0}.github.io.git {1}".format(github_pages, repodir),
echo=True,
)

Expand Down Expand Up @@ -469,12 +461,12 @@ def ablog_deploy(
run("git add -f .nojekyll")

# Check to see if anything has actually been committed
result = run('git diff --cached --name-status HEAD')
if (not result.stdout):
print('Nothing changed from last deployment')
result = run("git diff --cached --name-status HEAD")
if not result.stdout:
print("Nothing changed from last deployment")
return

commit = 'git commit -m "{}"'.format(message or 'Updates.')
commit = 'git commit -m "{}"'.format(message or "Updates.")
if push_force:
commit += " --amend"
run(commit, echo=True)
Expand Down
9 changes: 4 additions & 5 deletions ablog/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@
# 'Earth': ('The Blue Planet', 'https://en.wikipedia.org/wiki/Earth),
#}
# -- Blog Post Related --------------------------------------------------------
# post_date_format = '%%b %%d, %%Y'
# Format date for a post.
#post_date_format = '%%b %%d, %%Y'
# Number of paragraphs (default is ``1``) that will be displayed as an excerpt
# from the post. Setting this ``0`` will result in displaying no post excerpt
Expand Down Expand Up @@ -151,8 +150,8 @@
# is ``True``
# Link to `Font Awesome`_ at `Bootstrap CDN`_ and use icons in sidebars
# and post footers. Default: ``False``
fontawesome_link_cdn = True
# and post footers. Default: ``None``
#fontawesome_link_cdn = None
# Sphinx_ theme already links to `Font Awesome`_. Default: ``False``
#fontawesome_included = False
Expand Down
7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ packages = find:
include_package_data = True
setup_requires = setuptools_scm
install_requires =
werkzeug
sphinx>=2.0
alabaster
invoke
python-dateutil
sphinx-automodapi
sphinx>=2.0
watchdog
werkzeug

[options.extras_require]
notebook =
nbsphinx
ipython
nbsphinx

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit 1a46139

Please sign in to comment.