Skip to content

Commit 5dedc9e

Browse files
Create barebone structure
0 parents  commit 5dedc9e

21 files changed

+1135
-0
lines changed

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[report]
2+
omit =
3+
*/site-packages/*
4+
*/python?.?/*
5+
ckan/*

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.ropeproject
2+
node_modules
3+
bower_components
4+
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
env/
15+
build/
16+
develop-eggs/
17+
dist/
18+
sdist/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# PyInstaller
24+
# Usually these files are written by a python script from a template
25+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
26+
*.manifest
27+
*.spec
28+
29+
# Installer logs
30+
pip-log.txt
31+
pip-delete-this-directory.txt
32+
33+
# Unit test / coverage reports
34+
htmlcov/
35+
.tox/
36+
.coverage
37+
.cache
38+
nosetests.xml
39+
coverage.xml
40+
41+
# Sphinx documentation
42+
docs/_build/

.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
language: python
2+
sudo: required
3+
4+
# use an older trusty image, because the newer images cause build errors with
5+
# psycopg2 that comes with CKAN<2.8:
6+
#  "Error: could not determine PostgreSQL version from '10.1'"
7+
# see https://github.com/travis-ci/travis-ci/issues/8897
8+
dist: trusty
9+
group: deprecated-2017Q4
10+
11+
# matrix
12+
python:
13+
- 2.7
14+
env:
15+
- CKANVERSION=master
16+
- CKANVERSION=2.7
17+
- CKANVERSION=2.8
18+
19+
# tests
20+
services:
21+
- postgresql
22+
- redis-server
23+
install:
24+
- bash bin/travis-build.bash
25+
- pip install coveralls
26+
script: sh bin/travis-run.sh
27+
after_success:
28+
- coveralls
29+
30+
# additional jobs
31+
matrix:
32+
include:
33+
- name: "Flake8 on Python 3.7"
34+
dist: xenial # required for Python 3.7
35+
cache: pip
36+
install: pip install flake8
37+
script:
38+
- flake8 --version
39+
- flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --exclude ckan,ckanext-saml2auth
40+
python: 3.7
41+
# overwrite matrix
42+
env:
43+
- FLAKE8=true
44+
- CKANVERSION=master

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.rst
2+
include LICENSE
3+
include requirements.txt
4+
recursive-include ckanext/saml2auth *.html *.json *.js *.less *.css *.mo

README.rst

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
.. You should enable this project on travis-ci.org and coveralls.io to make
2+
these badges work. The necessary Travis and Coverage config files have been
3+
generated for you.
4+
5+
.. image:: https://travis-ci.org/duskobogdanovski/ckanext-saml2auth.svg?branch=master
6+
:target: https://travis-ci.org/duskobogdanovski/ckanext-saml2auth
7+
8+
.. image:: https://coveralls.io/repos/duskobogdanovski/ckanext-saml2auth/badge.svg
9+
:target: https://coveralls.io/r/duskobogdanovski/ckanext-saml2auth
10+
11+
.. image:: https://img.shields.io/pypi/v/ckanext-saml2auth.svg
12+
:target: https://pypi.org/project/ckanext-saml2auth/
13+
:alt: Latest Version
14+
15+
.. image:: https://img.shields.io/pypi/pyversions/ckanext-saml2auth.svg
16+
:target: https://pypi.org/project/ckanext-saml2auth/
17+
:alt: Supported Python versions
18+
19+
.. image:: https://img.shields.io/pypi/status/ckanext-saml2auth.svg
20+
:target: https://pypi.org/project/ckanext-saml2auth/
21+
:alt: Development Status
22+
23+
.. image:: https://img.shields.io/pypi/l/ckanext-saml2auth.svg
24+
:target: https://pypi.org/project/ckanext-saml2auth/
25+
:alt: License
26+
27+
=============
28+
ckanext-saml2auth
29+
=============
30+
31+
.. Put a description of your extension here:
32+
What does it do? What features does it have?
33+
Consider including some screenshots or embedding a video!
34+
35+
36+
------------
37+
Requirements
38+
------------
39+
40+
For example, you might want to mention here which versions of CKAN this
41+
extension works with.
42+
43+
44+
------------
45+
Installation
46+
------------
47+
48+
.. Add any additional install steps to the list below.
49+
For example installing any non-Python dependencies or adding any required
50+
config settings.
51+
52+
To install ckanext-saml2auth:
53+
54+
1. Activate your CKAN virtual environment, for example::
55+
56+
. /usr/lib/ckan/default/bin/activate
57+
58+
2. Install the ckanext-saml2auth Python package into your virtual environment::
59+
60+
pip install ckanext-saml2auth
61+
62+
3. Add ``saml2auth`` to the ``ckan.plugins`` setting in your CKAN
63+
config file (by default the config file is located at
64+
``/etc/ckan/default/ckan.ini``).
65+
66+
4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu::
67+
68+
sudo service apache2 reload
69+
70+
71+
---------------
72+
Config settings
73+
---------------
74+
75+
None at present
76+
77+
.. Document any optional config settings here. For example::
78+
79+
.. # The minimum number of hours to wait before re-checking a resource
80+
# (optional, default: 24).
81+
ckanext.saml2auth.some_setting = some_default_value
82+
83+
84+
----------------------
85+
Developer installation
86+
----------------------
87+
88+
To install ckanext-saml2auth for development, activate your CKAN virtualenv and
89+
do::
90+
91+
git clone https://github.com/duskobogdanovski/ckanext-saml2auth.git
92+
cd ckanext-saml2auth
93+
python setup.py develop
94+
pip install -r dev-requirements.txt
95+
96+
97+
-----
98+
Tests
99+
-----
100+
101+
To run the tests, do::
102+
103+
pytest --ckan-ini=test.ini
104+
105+
To run the tests and produce a coverage report, first make sure you have
106+
``pytest-cov`` installed in your virtualenv (``pip install pytest-cov``) then run::
107+
108+
pytest --ckan-ini=test.ini --cov=ckanext.saml2auth
109+
110+
111+
----------------------------------------
112+
Releasing a new version of ckanext-saml2auth
113+
----------------------------------------
114+
115+
ckanext-saml2auth should be available on PyPI as https://pypi.org/project/ckanext-saml2auth.
116+
To publish a new version to PyPI follow these steps:
117+
118+
1. Update the version number in the ``setup.py`` file.
119+
See `PEP 440 <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers>`_
120+
for how to choose version numbers.
121+
122+
2. Make sure you have the latest version of necessary packages::
123+
124+
pip install --upgrade setuptools wheel twine
125+
126+
3. Create a source and binary distributions of the new version::
127+
128+
python setup.py sdist bdist_wheel && twine check dist/*
129+
130+
Fix any errors you get.
131+
132+
4. Upload the source distribution to PyPI::
133+
134+
twine upload dist/*
135+
136+
5. Commit any outstanding changes::
137+
138+
git commit -a
139+
git push
140+
141+
6. Tag the new release of the project on GitHub with the version number from
142+
the ``setup.py`` file. For example if the version number in ``setup.py`` is
143+
0.0.1 then do::
144+
145+
git tag 0.0.1
146+
git push --tags

bin/travis-build.bash

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "This is travis-build.bash..."
5+
6+
echo "Installing the packages that CKAN requires..."
7+
sudo apt-get update -qq
8+
sudo apt-get install solr-jetty
9+
10+
echo "Installing CKAN and its Python dependencies..."
11+
git clone https://github.com/ckan/ckan
12+
cd ckan
13+
if [ $CKANVERSION == 'master' ]
14+
then
15+
echo "CKAN version: master"
16+
else
17+
CKAN_TAG=$(git tag | grep ^ckan-$CKANVERSION | sort --version-sort | tail -n 1)
18+
git checkout $CKAN_TAG
19+
echo "CKAN version: ${CKAN_TAG#ckan-}"
20+
fi
21+
22+
# install the recommended version of setuptools
23+
if [ -f requirement-setuptools.txt ]
24+
then
25+
echo "Updating setuptools..."
26+
pip install -r requirement-setuptools.txt
27+
fi
28+
29+
if [ $CKANVERSION == '2.7' ]
30+
then
31+
echo "Installing setuptools"
32+
pip install setuptools==39.0.1
33+
fi
34+
35+
python setup.py develop
36+
pip install -r requirements.txt
37+
pip install -r dev-requirements.txt
38+
cd -
39+
40+
echo "Creating the PostgreSQL user and database..."
41+
sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';"
42+
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'
43+
44+
echo "Setting up Solr..."
45+
# Solr is multicore for tests on ckan master, but it's easier to run tests on
46+
# Travis single-core. See https://github.com/ckan/ckan/issues/2972
47+
sed -i -e 's/solr_url.*/solr_url = http:\/\/127.0.0.1:8983\/solr/' ckan/test-core.ini
48+
printf "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" | sudo tee /etc/default/jetty
49+
sudo cp ckan/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml
50+
sudo service jetty restart
51+
52+
echo "Initialising the database..."
53+
cd ckan
54+
paster db init -c test-core.ini
55+
cd -
56+
57+
echo "Installing ckanext-saml2auth and its requirements..."
58+
python setup.py develop
59+
pip install -r dev-requirements.txt
60+
61+
echo "Moving test.ini into a subdir..."
62+
mkdir subdir
63+
mv test.ini subdir
64+
65+
echo "travis-build.bash is done."

bin/travis-run.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh -e
2+
set -ex
3+
4+
flake8 --version
5+
# stop the build if there are Python syntax errors or undefined names
6+
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude ckan,ckanext-saml2auth
7+
8+
pytest --ckan-ini=subdir/test.ini \
9+
--cov=ckanext.saml2auth
10+
11+
# strict linting
12+
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --exclude ckan,ckanext-saml2auth

ckanext/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# encoding: utf-8
2+
3+
# this is a namespace package
4+
try:
5+
import pkg_resources
6+
pkg_resources.declare_namespace(__name__)
7+
except ImportError:
8+
import pkgutil
9+
__path__ = pkgutil.extend_path(__path__, __name__)

ckanext/saml2auth/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)