forked from nowsecure/datagrid-gtk3
-
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.
Initial boilerplate from cookiecutter.
- Loading branch information
Toni Ruža
committed
Dec 15, 2014
0 parents
commit 84a4504
Showing
32 changed files
with
1,193 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib | ||
lib64 | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
htmlcov | ||
cover | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# Complexity | ||
output/*.html | ||
output/*/index.html | ||
|
||
# Sphinx | ||
docs/_build |
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,5 @@ | ||
======= | ||
Credits | ||
======= | ||
|
||
* viaForensics <[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,9 @@ | ||
.. :changelog: | ||
History | ||
------- | ||
|
||
0.1.0 (2014-12-15) | ||
--------------------- | ||
|
||
* Initial release. |
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,3 @@ | ||
(c) Copyright 2014 viaForensics. All rights reserved. | ||
|
||
See datagrid-gtk2/data/LICENSE.txt for complete credits. |
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,8 @@ | ||
include AUTHORS.rst | ||
include HISTORY.rst | ||
include LICENSE | ||
include README.rst | ||
include requirements.txt | ||
|
||
recursive-include *.so | ||
recursive-include datagrid-gtk2/data * |
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,83 @@ | ||
SHELL := /bin/bash | ||
.PHONY: clean-pyc clean-build docs clean | ||
|
||
help: | ||
@echo "clean-build - remove build artifacts" | ||
@echo "clean-pyc - remove Python file artifacts" | ||
@echo "lint - check style with flake8" | ||
@echo "test - run tests quickly with the default Python" | ||
@echo "test-unit - run unit tests quickly with the default Python (assumes separate 'functional' test directory)" | ||
@echo "coverage - check code coverage quickly with the default Python" | ||
@echo "docs - generate Sphinx HTML documentation, including API docs" | ||
@echo "release - package and upload a release" | ||
@echo "dist - package" | ||
@echo "dist-wheel - package with wheel" | ||
@echo "deb-dist - create deb package; requires python-stdeb installed" | ||
@echo "virtualenv - make virtualenv and install requirements; requires virtualenvwrapper" | ||
@echo "virtualenv-gtk - link required PyGTK paths to virtualenv" | ||
|
||
clean: clean-build clean-pyc | ||
rm -fr htmlcov/ | ||
|
||
clean-build: | ||
rm -fr build/ | ||
rm -fr dist/ | ||
rm -fr deb_dist/ | ||
rm -fr *.egg-info | ||
|
||
clean-pyc: | ||
find . -name '*.pyc' -exec rm -f {} + | ||
find . -name '*.pyo' -exec rm -f {} + | ||
find . -name '*~' -exec rm -f {} + | ||
|
||
lint: | ||
flake8 datagrid-gtk2 | ||
|
||
test: | ||
python setup.py nosetests | ||
|
||
test-unit: | ||
python setup.py nosetests --exclude=functional | ||
|
||
coverage: | ||
coverage run --source datagrid-gtk2 setup.py test | ||
coverage report -m | ||
coverage html | ||
xdg-open htmlcov/index.html | ||
|
||
docs: | ||
rm -f docs/datagrid-gtk2.rst | ||
rm -f docs/modules.rst | ||
sphinx-apidoc -o docs/api datagrid-gtk2 --force | ||
$(MAKE) -C docs clean | ||
$(MAKE) -C docs html | ||
xdg-open docs/_build/html/index.html | ||
|
||
# WARNING: open source only | ||
# release: clean | ||
# python setup.py sdist upload | ||
# python setup.py bdist_wheel upload | ||
# END WARNING | ||
|
||
dist: clean | ||
python setup.py sdist | ||
python setup.py bdist_egg | ||
ls -l dist | ||
|
||
# NOTE: dist-wheel requires wheel Python package | ||
dist-wheel: clean | ||
python setup.py sdist | ||
python setup.py bdist_wheel | ||
ls -l dist | ||
|
||
# NOTE: deb-dist requires python-stdeb .deb pkg installed | ||
deb-dist: clean | ||
python setup.py --command-packages=stdeb.command bdist_deb | ||
ls -l deb_dist | ||
|
||
virtualenv: | ||
test -d $(WORKON_HOME)/datagrid-gtk2 || virtualenv $(WORKON_HOME)/datagrid-gtk2 | ||
. $(WORKON_HOME)/datagrid-gtk2/bin/activate; pip install -r requirements.txt -r test_requirements.txt | ||
|
||
virtualenv-gtk: | ||
ln -sf /usr/lib/python2.7/dist-packages/{glib,gobject,cairo,gtk-2.0,pygtk.py,pygtk.pth} $(VIRTUAL_ENV)/lib/python2.7/site-packages |
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,5 @@ | ||
=============================== | ||
datagrid-gtk2 | ||
=============================== | ||
|
||
MVC framework for working with the GTK2 TreeView widget. |
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,75 @@ | ||
#!/bin/bash | ||
|
||
### | ||
# Create a .deb package from Python library in the current working directory | ||
# with CodeMeter-encrypted bytecode. | ||
# | ||
# NOTE: this is a work in progress that has been tested on Santoku 0.4 and | ||
# currently requires the following: | ||
# | ||
# - sudo apt-get install dpkg-dev debhelper python-all-dev | ||
# - sudo pip install stdeb # (outside of virtualenv) | ||
# - viaForensics pycEncrypt utility available in executable path | ||
# | ||
# IMPORTANT: deactivate any active virtualenv before you run this script. | ||
# | ||
# Example: | ||
# ./create_encrypted_deb_pkg.sh 5000342 2000 124 /my_path/versionkeys/RSApublic-v1.key | ||
|
||
FIRM_CODE=$1 | ||
PRODUCT_CODE=$2 | ||
MEM_LOCATION=$3 | ||
PUBLIC_KEY_LOCATION=$4 | ||
|
||
CUR_DIR=`pwd` | ||
MODIFY_PKG_SCRIPT="${CUR_DIR}/bin/buildtools/modify_deb_pkg.sh" | ||
|
||
if [[ ! -f $PUBLIC_KEY_LOCATION ]]; then | ||
echo "[!] Public key for CodeMeter bytecode encryption not found" | ||
exit 1 | ||
fi | ||
KEY_PATH=`realpath ${PUBLIC_KEY_LOCATION}` | ||
|
||
# build package | ||
echo "==> Building package" | ||
python setup.py --command-packages=stdeb.command sdist_dsc | ||
if [[ -f $MODIFY_PKG_SCRIPT ]]; then | ||
${MODIFY_PKG_SCRIPT} | ||
fi | ||
cd deb_dist/datagrid-gtk2-* | ||
dpkg-buildpackage -uc -us | ||
|
||
# unpackage .deb pkg and modify it for codemeter encryption | ||
# FIXME: obviously ideally this wouldn't be necessary, but packaging tools | ||
# seem to have a need to introspect Python files, which is broken by our | ||
# CodeMeter dependency -- how else to fix? | ||
echo "==> Processing package for CodeMeter encryption" | ||
BUILD_DIR="/tmp/datagrid-gtk2_build" | ||
cd $CUR_DIR | ||
DEB_NAME=`find ./deb_dist -type f -name "python-datagrid-gtk2*.deb" | xargs basename` | ||
rm -rf $BUILD_DIR | ||
mkdir $BUILD_DIR | ||
echo "==> Processing package: ${DEB_NAME}" | ||
cp deb_dist/$DEB_NAME $BUILD_DIR | ||
cd $BUILD_DIR | ||
dpkg-deb -x $DEB_NAME . | ||
dpkg-deb -e $DEB_NAME | ||
rm $DEB_NAME | ||
cd $BUILD_DIR/usr/lib/python2.7/dist-packages | ||
# remove pyshared-related items | ||
find datagrid-gtk2 -type l -exec bash -c 'ln -f "$(readlink -m "$0")" "$0"' {} \; | ||
find datagrid-gtk2*.egg-info -type l -exec bash -c 'ln -f "$(readlink -m "$0")" "$0"' {} \; | ||
rm -rf $BUILD_DIR/usr/share/pyshared | ||
rm -rf $BUILD_DIR/usr/lib/python2.7/dist-packages/datagrid-gtk2*.egg-info/requires.txt | ||
rm -rf $BUILD_DIR/DEBIAN/md5sums | ||
# compile and encrypt source | ||
find datagrid-gtk2 -type f -name "*.pyc" -exec rm {} \; | ||
python -m compileall datagrid-gtk2 | ||
find datagrid-gtk2 -type f -name "*.py" -exec rm {} \; | ||
find datagrid-gtk2 -type f -name "*.pyc" -exec pycEncrypt e f${FIRM_CODE} p${PRODUCT_CODE} R${MEM_LOCATION} ${KEY_PATH} {} {} \; | ||
|
||
# rebuild package | ||
cd $BUILD_DIR | ||
dpkg-deb -b . /tmp/$DEB_NAME | ||
mv /tmp/$DEB_NAME $CUR_DIR | ||
rm -rf $BUILD_DIR |
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,12 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Automatically added by dh_python2: | ||
if which pycompile >/dev/null 2>&1; then | ||
pycompile -p viaextract | ||
fi | ||
|
||
# End automatically added section | ||
|
||
# use custom CodeMeter-enabled python interpeter | ||
sudo sed -i "s/\#\!\/usr\/bin\/python/\#\!\/usr\/local\/bin\/python.via/g" /usr/bin/datagrid-gtk2 |
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 @@ | ||
cp bin/buildtools/debian/postinst deb_dist/datagrid-gtk2-*/debian/ |
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,3 @@ | ||
#!/bin/bash | ||
export VIA_DEBUG=1 | ||
python -m datagrid-gtk2.main |
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 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__author__ = 'viaForensics' | ||
__email__ = '[email protected]' | ||
__version__ = '0.1.0' | ||
|
||
# Set default logging handler to avoid "No handler found" warnings. | ||
import logging | ||
logging.getLogger(__name__).addHandler(logging.NullHandler()) |
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 @@ | ||
(c) Copyright 2014 viaForensics. All rights reserved. |
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 @@ | ||
Package data files go here. See setup.py |
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,16 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Main module.""" | ||
|
||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def main(): | ||
"""This is the main function.""" | ||
logger.info('Printing hello message.') | ||
print 'Hello from datagrid-gtk2' | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# NOTE: tests directory can go either inside or outside package directory. | ||
# In cases where the production environment is likely to be quite different | ||
# from the development environment, it can be useful to distribute the | ||
# tests to be able to run them in the production environment. |
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,26 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
test_datagrid-gtk2 | ||
---------------------------------- | ||
Tests for `datagrid-gtk2` module. | ||
""" | ||
|
||
import unittest | ||
|
||
|
||
class TestDatagrid-gtk2(unittest.TestCase): | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def test_something(self): | ||
pass | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.