Skip to content

Commit a7cc5a1

Browse files
committed
Initial bash at a framework
Using Foundation 5 for styles, Flask for web framework, and pulling in numpy and scipy for eventual calculations. Probably WTForms as well.
1 parent 6900a77 commit a7cc5a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+12929
-0
lines changed

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
prune debian
2+
prune docs
3+
include README.rst
4+
include LICENSE.txt

Makefile

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# vim: set noet sw=4 ts=4 fileencoding=utf-8:
2+
3+
# External utilities
4+
PYTHON=python
5+
PIP=pip
6+
PYTEST=py.test
7+
COVERAGE=coverage
8+
PYFLAGS=
9+
DEST_DIR=/
10+
11+
# Horrid hack to ensure setuptools is installed in our Python environment. This
12+
# is necessary with Python 3.3's venvs which don't install it by default.
13+
ifeq ($(shell python -c "import setuptools" 2>&1),)
14+
SETUPTOOLS:=
15+
else
16+
SETUPTOOLS:=$(shell wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | $(PYTHON))
17+
endif
18+
19+
# Calculate the base names of the distribution, the location of all source,
20+
# documentation, packaging, icon, and executable script files
21+
NAME:=$(shell $(PYTHON) $(PYFLAGS) setup.py --name)
22+
VER:=$(shell $(PYTHON) $(PYFLAGS) setup.py --version)
23+
ifeq ($(shell lsb_release -si),Ubuntu)
24+
DEB_SUFFIX:=ubuntu1
25+
else
26+
DEB_SUFFIX:=
27+
endif
28+
PYVER:=$(shell $(PYTHON) $(PYFLAGS) -c "import sys; print('py%d.%d' % sys.version_info[:2])")
29+
PY_SOURCES:=$(shell \
30+
$(PYTHON) $(PYFLAGS) setup.py egg_info >/dev/null 2>&1 && \
31+
grep -v "\.egg-info" $(NAME).egg-info/SOURCES.txt)
32+
DEB_SOURCES:=debian/changelog \
33+
debian/control \
34+
debian/copyright \
35+
debian/rules \
36+
debian/docs \
37+
$(wildcard debian/*.init) \
38+
$(wildcard debian/*.default) \
39+
$(wildcard debian/*.manpages) \
40+
$(wildcard debian/*.docs) \
41+
$(wildcard debian/*.doc-base) \
42+
$(wildcard debian/*.desktop)
43+
DOC_SOURCES:=docs/conf.py \
44+
$(wildcard docs/*.png) \
45+
$(wildcard docs/*.svg) \
46+
$(wildcard docs/*.rst) \
47+
$(wildcard docs/*.pdf)
48+
SUBDIRS:=icons $(NAME)/windows/fallback-theme
49+
50+
# Calculate the name of all outputs
51+
DIST_EGG=dist/$(NAME)-$(VER)-$(PYVER).egg
52+
DIST_TAR=dist/$(NAME)-$(VER).tar.gz
53+
DIST_ZIP=dist/$(NAME)-$(VER).zip
54+
DIST_DEB=dist/$(NAME)-$(VER)-1$(DEB_SUFFIX)_all.deb \
55+
dist/$(NAME)-docs_$(VER)-1$(DEB_SUFFIX)_all.deb
56+
DIST_DSC=dist/$(NAME)_$(VER)-1$(DEB_SUFFIX).tar.gz \
57+
dist/$(NAME)_$(VER)-1$(DEB_SUFFIX).dsc \
58+
dist/$(NAME)_$(VER)-1$(DEB_SUFFIX)_source.changes
59+
MAN_PAGES=
60+
61+
62+
# Default target
63+
all:
64+
@echo "make install - Install on local system"
65+
@echo "make develop - Install symlinks for development"
66+
@echo "make test - Run tests"
67+
@echo "make doc - Generate HTML and PDF documentation"
68+
@echo "make source - Create source package"
69+
@echo "make egg - Generate a PyPI egg package"
70+
@echo "make zip - Generate a source zip package"
71+
@echo "make tar - Generate a source tar package"
72+
@echo "make deb - Generate Debian packages"
73+
@echo "make dist - Generate all packages"
74+
@echo "make clean - Get rid of all generated files"
75+
@echo "make release - Create and tag a new release"
76+
@echo "make upload - Upload the new release to repositories"
77+
78+
install: $(SUBDIRS)
79+
$(PYTHON) $(PYFLAGS) setup.py install --root $(DEST_DIR)
80+
81+
doc: $(DOC_SOURCES)
82+
$(MAKE) -C docs html latexpdf
83+
84+
source: $(DIST_TAR) $(DIST_ZIP)
85+
86+
egg: $(DIST_EGG)
87+
88+
zip: $(DIST_ZIP)
89+
90+
tar: $(DIST_TAR)
91+
92+
deb: $(DIST_DEB) $(DIST_DSC)
93+
94+
dist: $(DIST_EGG) $(DIST_DEB) $(DIST_DSC) $(DIST_TAR) $(DIST_ZIP)
95+
96+
develop: tags
97+
$(PIP) install -e .
98+
99+
test:
100+
$(COVERAGE) run -m $(PYTEST) tests -v
101+
$(COVERAGE) report --rcfile coverage.cfg
102+
103+
clean:
104+
$(PYTHON) $(PYFLAGS) setup.py clean
105+
$(MAKE) -f $(CURDIR)/debian/rules clean
106+
$(MAKE) -C docs clean
107+
rm -fr build/ dist/ $(NAME).egg-info/ tags
108+
for dir in $(SUBDIRS); do \
109+
$(MAKE) -C $$dir clean; \
110+
done
111+
find $(CURDIR) -name "*.pyc" -delete
112+
113+
tags: $(PY_SOURCES)
114+
ctags -R --exclude="build/*" --exclude="debian/*" --exclude="docs/*" --languages="Python"
115+
116+
$(SUBDIRS):
117+
$(MAKE) -C $@
118+
119+
$(MAN_PAGES): $(DOC_SOURCES)
120+
$(PYTHON) $(PYFLAGS) setup.py build_sphinx -b man
121+
mkdir -p man/
122+
cp build/sphinx/man/*.[0-9] man/
123+
124+
$(DIST_TAR): $(PY_SOURCES) $(SUBDIRS)
125+
$(PYTHON) $(PYFLAGS) setup.py sdist --formats gztar
126+
127+
$(DIST_ZIP): $(PY_SOURCES) $(SUBDIRS)
128+
$(PYTHON) $(PYFLAGS) setup.py sdist --formats zip
129+
130+
$(DIST_EGG): $(PY_SOURCES) $(SUBDIRS)
131+
$(PYTHON) $(PYFLAGS) setup.py bdist_egg
132+
133+
$(DIST_DEB): $(PY_SOURCES) $(SUBDIRS) $(DEB_SOURCES) $(MAN_PAGES)
134+
# build the binary package in the parent directory then rename it to
135+
# project_version.orig.tar.gz
136+
$(PYTHON) $(PYFLAGS) setup.py sdist --dist-dir=../
137+
rename -f 's/$(NAME)-(.*)\.tar\.gz/$(NAME)_$$1\.orig\.tar\.gz/' ../*
138+
debuild -b -i -I -Idist -Ibuild -Idocs/_build -Icoverage -I__pycache__ -I.coverage -Itags -I*.pyc -I*.vim -rfakeroot
139+
mkdir -p dist/
140+
for f in $(DIST_DEB); do cp ../$${f##*/} dist/; done
141+
142+
$(DIST_DSC): $(PY_SOURCES) $(SUBDIRS) $(DEB_SOURCES) $(MAN_PAGES)
143+
# build the source package in the parent directory then rename it to
144+
# project_version.orig.tar.gz
145+
$(PYTHON) $(PYFLAGS) setup.py sdist --dist-dir=../
146+
rename -f 's/$(NAME)-(.*)\.tar\.gz/$(NAME)_$$1\.orig\.tar\.gz/' ../*
147+
debuild -S -i -I -Idist -Ibuild -Idocs/_build -Icoverage -I__pycache__ -I.coverage -Itags -I*.pyc -I*.vim -rfakeroot
148+
mkdir -p dist/
149+
for f in $(DIST_DSC); do cp ../$${f##*/} dist/; done
150+
151+
release: $(PY_SOURCES) $(DOC_SOURCES) $(DEB_SOURCES)
152+
# ensure there are no current uncommitted changes
153+
test -z "$(shell git status --porcelain)"
154+
# update the changelog with new release information
155+
dch --newversion $(VER)-1$(DEB_SUFFIX) --controlmaint
156+
# commit the changes and add a new tag
157+
git commit debian/changelog -m "Updated changelog for release $(VER)"
158+
git tag -s release-$(VER) -m "Release $(VER)"
159+
# update the package's registration on PyPI (in case any metadata's changed)
160+
$(PYTHON) $(PYFLAGS) setup.py register
161+
162+
upload: $(PY_SOURCES) $(DOC_SOURCES) $(DIST_DEB) $(DIST_DSC)
163+
# build a source archive and upload to PyPI
164+
$(PYTHON) $(PYFLAGS) setup.py sdist upload
165+
# build the deb source archive and upload to the PPA
166+
dput waveform-ppa dist/$(NAME)_$(VER)-1$(DEB_SUFFIX)_source.changes
167+
git push --tags
168+
169+
.PHONY: all install develop test doc source egg zip tar deb dist clean tags release-pi release-ubuntu upload-pi upload-ubuntu $(SUBDIRS)
170+

setup.py

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python
2+
# vim: set et sw=4 sts=4:
3+
4+
# Copyright 2014 Dave Hughes <[email protected]>.
5+
#
6+
# This file is part of umansysprop.
7+
#
8+
# umansysprop is free software: you can redistribute it and/or modify it under
9+
# the terms of the GNU General Public License as published by the Free Software
10+
# Foundation, either version 3 of the License, or (at your option) any later
11+
# version.
12+
#
13+
# umansysprop is distributed in the hope that it will be useful, but WITHOUT
14+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16+
# details.
17+
#
18+
# You should have received a copy of the GNU General Public License along with
19+
# umansysprop. If not, see <http://www.gnu.org/licenses/>.
20+
21+
from __future__ import (
22+
unicode_literals,
23+
absolute_import,
24+
print_function,
25+
division,
26+
)
27+
str = type('')
28+
29+
import os
30+
import sys
31+
from setuptools import setup, find_packages
32+
33+
if sys.version_info[0] == 2:
34+
if not sys.version_info >= (2, 7):
35+
raise ValueError('This application requires Python 2.7 or above')
36+
elif sys.version_info[0] == 3:
37+
if not sys.version_info >= (3, 2):
38+
raise ValueError('This application requires Python 3.2 or above')
39+
else:
40+
raise ValueError('Unrecognized major version of Python')
41+
42+
HERE = os.path.abspath(os.path.dirname(__file__))
43+
44+
# Workaround <http://bugs.python.org/issue10945>
45+
import codecs
46+
try:
47+
codecs.lookup('mbcs')
48+
except LookupError:
49+
ascii = codecs.lookup('ascii')
50+
func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs')
51+
codecs.register(func)
52+
53+
# Workaround <http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html>
54+
try:
55+
import multiprocessing
56+
except ImportError:
57+
pass
58+
59+
def main():
60+
import io
61+
import umansysprop as app
62+
with io.open(os.path.join(HERE, 'README.rst'), 'r') as readme:
63+
setup(
64+
name = app.__project__,
65+
version = app.__version__,
66+
description = app.__doc__,
67+
long_description = readme.read(),
68+
classifiers = app.__classifiers__,
69+
author = app.__author__,
70+
author_email = app.__author_email__,
71+
url = app.__url__,
72+
license = [
73+
c.rsplit('::', 1)[1].strip()
74+
for c in app.__classifiers__
75+
if c.startswith('License ::')
76+
][0],
77+
keywords = app.__keywords__,
78+
packages = find_packages(),
79+
include_package_data = True,
80+
platforms = app.__platforms__,
81+
install_requires = app.__requires__,
82+
extras_require = app.__extra_requires__,
83+
entry_points = app.__entry_points__,
84+
)
85+
86+
87+
if __name__ == '__main__':
88+
main()

umansysprop/__init__.py

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# vim: set et sw=4 sts=4 fileencoding=utf-8:
2+
#
3+
# Copyright 2014 Dave Hughes <[email protected]>.
4+
#
5+
# This file is part of umansysprop.
6+
#
7+
# umansysprop is free software: you can redistribute it and/or modify it under
8+
# the terms of the GNU General Public License as published by the Free Software
9+
# Foundation, either version 3 of the License, or (at your option) any later
10+
# version.
11+
#
12+
# umansysprop is distributed in the hope that it will be useful, but WITHOUT
13+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15+
# details.
16+
#
17+
# You should have received a copy of the GNU General Public License along with
18+
# umansysprop. If not, see <http://www.gnu.org/licenses/>.
19+
20+
"""An online system for calculating the properties of individual organic
21+
molecules and ensemble mixtures"""
22+
23+
from __future__ import (
24+
unicode_literals,
25+
absolute_import,
26+
print_function,
27+
division,
28+
)
29+
str = type('')
30+
31+
import sys
32+
33+
__project__ = 'umansysprop'
34+
__version__ = '0.1'
35+
__keywords__ = ['science', 'organic', 'chemistry']
36+
__author__ = 'Dave Hughes'
37+
__author_email__ = '[email protected]'
38+
__url__ = 'http://umansysprop.readthedocs.org/'
39+
__platforms__ = 'ALL'
40+
41+
__requires__ = [
42+
'Flask',
43+
'wtforms',
44+
'numpy',
45+
'scipy',
46+
]
47+
48+
__extra_requires__ = {
49+
'doc': ['sphinx'],
50+
}
51+
52+
if sys.version_info[:2] == (3, 2):
53+
__extra_requires__['doc'].extend([
54+
# Particular versions are required for Python 3.2 compatibility.
55+
# The ordering is reverse because that's what easy_install needs...
56+
'Jinja<2.7',
57+
'MarkupSafe<0.16',
58+
])
59+
60+
__classifiers__ = [
61+
'Development Status :: 4 - Beta',
62+
'Environment :: Web Environment',
63+
'Intended Audience :: Science/Research',
64+
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
65+
'Operating System :: POSIX',
66+
'Operating System :: Unix',
67+
'Programming Language :: Python :: 2.7',
68+
'Programming Language :: Python :: 3',
69+
'Topic :: Scientific/Engineering :: Atmospheric Science',
70+
]
71+
72+
__entry_points__ = {
73+
'console_scripts': [
74+
'umansyspropd = umansysprop.server:main',
75+
],
76+
}
77+

0 commit comments

Comments
 (0)