-
Notifications
You must be signed in to change notification settings - Fork 1
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 #24 from VirgilSecurity/v5
V5
- Loading branch information
Showing
10 changed files
with
141 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ virgil_crypto/*virgil_crypto_python* | |
.vscode | ||
.DS_Store | ||
/doc-source/api-doc/ | ||
generated-docs/ | ||
generated-docs/ | ||
docs/ |
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 |
---|---|---|
|
@@ -11,6 +11,10 @@ python: | |
|
||
env: | ||
global: | ||
- REPO=VirgilSecurity/virgil-sdk-python | ||
- GIT_TAG=$TRAVIS_TAG | ||
- GIT_COMMIT=$TRAVIS_COMMIT | ||
- GIT_BRANCH=$TRAVIS_BRANCH | ||
- OS_NAME=$(echo $TRAVIS_OS_NAME) | ||
|
||
matrix: | ||
|
@@ -78,6 +82,23 @@ script: | |
- pwd | ||
- python -m unittest discover -s virgil_crypto/tests -p "*_test.py" | ||
|
||
after_success: | | ||
if [[ $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
make docs | ||
fi | ||
deploy: | ||
# Upload docs to gh-pages | ||
- provider: pages | ||
skip_cleanup: true | ||
github-token: $GITHUB_ACCESS_TOKEN | ||
local_dir: "docs" | ||
on: | ||
repo: $REPO | ||
tags: true | ||
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+ | ||
|
||
notifications: | ||
email: | ||
- [email protected] |
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,66 @@ | ||
.PHONY: wheel docs | ||
|
||
PYTHON3="python3.5" | ||
REPO=VirgilSecurity/virgil-crypto-python | ||
REPO_PATH=https://github.com/${REPO}.git | ||
DOCS_DEST="./docs" | ||
API_DOCS="./doc-source/api-doc" | ||
CURRENT_VERSION=$$(sed -n -E -e 's/__version__ = \"(.*)\"/\1/p' virgil_crypto/__init__.py) | ||
CURRENT_VERSION_DIR="${DOCS_DEST}/v${CURRENT_VERSION}" | ||
|
||
define clean_api_docs | ||
@echo "Clean api-docs directory" | ||
@if [ -d ${API_DOCS} ]; then \ | ||
rm -r ${API_DOCS}; \ | ||
fi | ||
endef | ||
|
||
define clean_dist | ||
@echo "Clean docs directory" | ||
@if [ -d ./dist ]; then \ | ||
rm -r ./dist; \ | ||
fi | ||
endef | ||
|
||
define clean_after_wheel | ||
@echo "Cleaning after wheel build" | ||
rm -r ./build | ||
rm -r ./*.egg-info | ||
endef | ||
|
||
sphinx_docs: | ||
@echo ">>> Generate Api Docs" | ||
$(call clean_api_docs) | ||
sphinx-apidoc -f -e -R ${GIT_TAG} -V ${GIT_TAG} -o ${API_DOCS} ./virgil_crypto *test* | ||
|
||
|
||
@echo "Check ${DOCS_DEST} exist" | ||
@if [ -d ${API_DOCS} ]; then \ | ||
if [ ! -d ${API_DOCS} ]; then \ | ||
mkdir ${API_DOCS}; \ | ||
fi \ | ||
else \ | ||
mkdir -p ${API_DOCS}; \ | ||
fi | ||
|
||
sphinx-build ./doc-source ${CURRENT_VERSION_DIR} | ||
|
||
docs: | ||
@echo ">>> Start generating docs" | ||
mkdir -p ${DOCS_DEST} | ||
git clone -b gh-pages "${REPO_PATH}" --single-branch ${DOCS_DEST} | ||
make sphinx_docs | ||
${PYTHON3} -m pip install jinja2 | ||
${PYTHON3} ci/render_index.py ${DOCS_DEST} | ||
|
||
wheel: | ||
${PYTHON3} setup.py bdist_wheel --universal --python-tag py2.py3 | ||
$(call clean_after_wheel) | ||
|
||
|
||
upload_testpypi: | ||
twine upload -r pypitest dist/* | ||
|
||
clean: | ||
$(call clean_api_docs) | ||
$(call clean_dist) |
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,15 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Virgil Security Python Crypto</title> | ||
</head> | ||
<body> | ||
Virgil Security Python Crypto | ||
<ul> | ||
{%- for dir in version_dirs %} | ||
<li><p><a href="{{ dir }}/index.html">{{ dir }}</a></p></li> | ||
{%- endfor %} | ||
</ul> | ||
</body> | ||
</html> |
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,21 @@ | ||
from jinja2 import Environment, FileSystemLoader, select_autoescape | ||
import os | ||
import sys | ||
|
||
if __name__ == '__main__': | ||
template_loader = FileSystemLoader(searchpath="./") | ||
env = Environment( | ||
loader=template_loader, | ||
autoescape=select_autoescape(['html']) | ||
) | ||
|
||
template = env.get_template('ci/index.html') | ||
|
||
target_dir = sys.argv[1] | ||
version_list = list() | ||
for item in os.listdir(target_dir): | ||
item_full_path = os.path.join(target_dir, item) | ||
if os.path.isdir(item_full_path) and "git" not in item: | ||
version_list.append((item)) | ||
|
||
open(os.path.join(target_dir, "index.html"), "w").write(template.render(version_dirs=version_list)) |
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,9 @@ | ||
Installation | ||
============ | ||
|
||
The Virgil Crypto is provided as a package named *virgil-crypto*. The package is distributed via Pypi package management system. | ||
To install the pip package use the command below | ||
|
||
.. code-block:: bash | ||
pip install virgil-crypto |
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