forked from DataShades/ckanext-datarequests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request conwetlab#51 from qld-gov-au/QOL-7970-CKAN-2.9
[QOL-7970] clean up for Flake8 and Python 3
- Loading branch information
Showing
25 changed files
with
321 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/sh | ||
|
||
# Call either 'ckan' (from CKAN >= 2.9) or 'paster' (from CKAN <= 2.8) | ||
# with appropriate syntax, depending on what is present on the system. | ||
# This is intended to smooth the upgrade process from 2.8 to 2.9. | ||
# Eg: | ||
# ckan_cli jobs list | ||
# could become either: | ||
# paster --plugin=ckan jobs list -c /etc/ckan/default/production.ini | ||
# or: | ||
# ckan -c /etc/ckan/default/production.ini jobs list | ||
|
||
# This script is aware of the VIRTUAL_ENV environment variable, and will | ||
# attempt to respect it with similar behaviour to commands like 'pip'. | ||
# Eg placing this script in a virtualenv 'bin' directory will cause it | ||
# to call the 'ckan' or 'paster' command in that directory, while | ||
# placing this script elsewhere will cause it to rely on the VIRTUAL_ENV | ||
# variable, or if that is not set, the system PATH. | ||
|
||
# Since the positioning of the CKAN configuration file is central to the | ||
# differences between 'paster' and 'ckan', this script needs to be aware | ||
# of the config file location. It will use the CKAN_INI environment | ||
# variable if it exists, or default to /etc/ckan/default/production.ini. | ||
|
||
# If 'paster' is being used, the default plugin is 'ckan'. A different | ||
# plugin can be specified by setting the PASTER_PLUGIN environment | ||
# variable. This variable is irrelevant if using the 'ckan' command. | ||
|
||
CKAN_INI="${CKAN_INI:-/etc/ckan/default/production.ini}" | ||
PASTER_PLUGIN="${PASTER_PLUGIN:-ckan}" | ||
# First, look for a command alongside this file | ||
ENV_DIR=$(dirname "$0") | ||
if [ -f "$ENV_DIR/ckan" ]; then | ||
COMMAND=ckan | ||
elif [ -f "$ENV_DIR/paster" ]; then | ||
COMMAND=paster | ||
elif [ "$VIRTUAL_ENV" != "" ]; then | ||
# If command not found alongside this file, check the virtualenv | ||
ENV_DIR="$VIRTUAL_ENV/bin" | ||
if [ -f "$ENV_DIR/ckan" ]; then | ||
COMMAND=ckan | ||
elif [ -f "$ENV_DIR/paster" ]; then | ||
COMMAND=paster | ||
fi | ||
else | ||
# if no virtualenv is active, try the system path | ||
if (which ckan > /dev/null 2>&1); then | ||
ENV_DIR=$(dirname $(which ckan)) | ||
COMMAND=ckan | ||
elif (which paster > /dev/null 2>&1); then | ||
ENV_DIR=$(dirname $(which paster)) | ||
COMMAND=paster | ||
else | ||
echo "Unable to locate 'ckan' or 'paster' command" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [ "$COMMAND" = "ckan" ]; then | ||
echo "Using 'ckan' command from $ENV_DIR..." >&2 | ||
exec $ENV_DIR/ckan -c ${CKAN_INI} "$@" | ||
elif [ "$COMMAND" = "paster" ]; then | ||
echo "Using 'paster' command from $ENV_DIR..." >&2 | ||
exec $ENV_DIR/paster --plugin=$PASTER_PLUGIN "$@" -c ${CKAN_INI} | ||
else | ||
echo "Unable to locate 'ckan' or 'paster' command in $ENV_DIR" >&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,7 @@ max-complexity = 10 | |
|
||
# List ignore rules one per line. | ||
ignore = | ||
E241 | ||
E266 | ||
E501 | ||
C901 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.