diff --git a/CHANGELOG b/CHANGELOG index 15c19e6..8590ba6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,5 @@ Copyright (C) 2017 Alpha Griffin @%@~LICENSE~@%@ -saw_041117_3 - Add Makefile. - -saw_041117_2 - Updated README. - -saw_041117_1 - Initial commit for fauxproject. +saw_042017_1 - First commit for fauxpython. diff --git a/Makefile b/Makefile index 6bb2c29..cfe1130 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 2017 Alpha Griffin # @%@~LICENSE~@%@ # -# A most basic make file. +# A simple make file for any Python project. .PHONY: default @@ -14,32 +14,34 @@ help: @echo "Please use \`make ' where is one of" @echo " help display this help screen" @echo "" - @echo " all to make all common tasks: example" - @echo " clean to clean all common tasks: example_clean" + @echo " all to make all common tasks: python" + @echo " clean to clean all common tasks: python_clean" @echo "" @echo " install to install what has been built to the system (first try make all)" @echo "" - @echo " example to build this example" - @echo " example_clean to clean up after this example build" + @echo " python to build Python code" + @echo " python_clean to clean up after Python build" -all: example +all: python -clean: example_clean +clean: python_clean -example: - @echo Congratulations...example build does nothing! +python: + ./setup.py build_py -example_clean: - @echo Congratulations...example build has nothing to clean up! +python_clean: + ./setup.py clean + rm -rf build + rm -rf *.egg-info + find . -type d -name __pycache__ | xargs -r rm -r install: - @echo Congratulations...faux project has nothing to install! - + ./setup.py install diff --git a/README.md b/README.rst similarity index 59% rename from README.md rename to README.rst index 182de82..d8b5be0 100644 --- a/README.md +++ b/README.rst @@ -1,9 +1,8 @@ -faux project -============ +=========== +faux python +=========== -Beginning project. - -See the other branches on this repository for projects tailored to specific languages/platforms. +Beginning Python project. Build Overview @@ -11,15 +10,15 @@ Build Overview An example `Makefile` is included in the master branch and that's about it. -The most common project build tasks are all provided in the Makefile. To see the full list of project targets: +The most common project build tasks are all provided in the Makefile. To see the full list of project targets:: make help -Build all the common tasks as follows: +Build all the common tasks as follows:: make all -To clean up all the common generated files from your project folder: +To clean up all the common generated files from your project folder:: make clean @@ -27,7 +26,7 @@ To clean up all the common generated files from your project folder: Installing ---------- -To install this project to the local system: +To install this project to the local system:: make install diff --git a/dummyscript/__init__.py b/dummyscript/__init__.py new file mode 100644 index 0000000..8f2bec3 --- /dev/null +++ b/dummyscript/__init__.py @@ -0,0 +1,17 @@ +# Copyright (C) 2017 Alpha Griffin +# @%@~LICENSE~@%@ + +"""DummyScript + +This package-init script currently simply handles namespace sharing. + +.. module:: dummyscript + :synopsis: DummyScript Namespace +""" +# (from http://github.com/google/protobuf) + +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + __path__ = __import__('pkgutil').extend_path(__path__, __name__) + diff --git a/dummyscript/fauxpython/__init__.py b/dummyscript/fauxpython/__init__.py new file mode 100644 index 0000000..a76f118 --- /dev/null +++ b/dummyscript/fauxpython/__init__.py @@ -0,0 +1,17 @@ +# Copyright (C) 2017 Alpha Griffin +# @%@~LICENSE~@%@ +"""Python Starter Project + +The sample DummyScript project allows you to easily get started +on a new Python project. + +.. module:: dummyscript.fauxpython + :platform: Unix + :synopsis: Python Starter Project +.. moduleauthor:: Shawn Wilson +""" + +from dummyscript.fauxpython.__version__ import __version__ + +print ("Sample DummyScript Python project version %s successfully installed!" % (__version__)) + diff --git a/dummyscript/fauxpython/__version__.py b/dummyscript/fauxpython/__version__.py new file mode 100644 index 0000000..446d9fd --- /dev/null +++ b/dummyscript/fauxpython/__version__.py @@ -0,0 +1,2 @@ +__version__ = '0.0.1' + diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..97afe57 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,11 @@ +# Copyright (C) 2017 Alpha Griffin +# @%@~LICENSE~@%@ +# +# Configuration script for setup.py + +[bdist_wheel] +# This flag says that the code is written to work on both Python 2 and Python +# 3. If at all possible, it is good practice to do this. If you cannot, you +# will need to generate wheels for each Python version that you support. +universal=1 + diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..016412d --- /dev/null +++ b/setup.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Alpha Griffin +# @%@~LICENSE~@%@ + +"""Python setuptools build script. + +@author lannocc + +@see https://packaging.python.org/en/latest/distributing.html +@see https://github.com/pypa/sampleproject + +Some of this script logic also taken from: + https://github.com/google/protobuf +""" + +# FIXME / note to self: +# read more at https://caremad.io/posts/2013/07/setup-vs-requirement/ +# -- to integrate fully pip + + + +# ------------------------------------------------------------------------------------- +# +# CUSTOMIZE THIS SECTION +# All the variables defined here should be customized for your project. +# + +NS = 'dummyscript' # namespace / meta-package folder +NAME = 'fauxpython' # should match source package name in NS folder +REQUIRE = [ ] # package dependencies + +DESC = 'DummyScript Starter Python Project' +TAGS = 'example utilities' # space-separated list of keywords + +AUTHOR = 'DummyScript' # name or alias of author +EMAIL = 'lannocc@alphagriffin.com' # email of author + +URL = 'http://dummyscript.com' +LICENSE = '' # type of license +COPY = '2017 Dummy Script' # copyright + +CLASS = [ + # @see https://pypi.python.org/pypi?%3Aaction=list_classifiers + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'Programming Language :: Python', + 'Topic :: System :: Installation/Setup', + 'Topic :: Utilities', +] + + +# +# END CUSTOMIZATION AREA +# ------------------------------------------------------------------------------------- + + + + + + + +################# +# !!! WARNING !!! +# !!! WARNING !!! +################# +# THINK CAREFULLY BEFORE CHANGING ANYTHING BELOW THIS LINE + +from setuptools import setup, find_packages, Command +from codecs import open +from os.path import join, splitext, dirname +from os import walk +from distutils.dep_util import newer + + +def findversion(root, name): + '''versioning strategy taken from http://stackoverflow.com/a/7071358/7203060''' + + import re + vfile = join(root, name, "__version__.py") + vmatch = re.search(r'^__version__ *= *["\']([^"\']*)["\']', open(vfile, "rt").read(), re.M) + if vmatch: + version = vmatch.group(1) + print ("Found %s version %s" % (name, version)) + return version + else: + raise RuntimeError("Expecting a version string in %s." % (vfile)) + + + + +if __name__ == '__main__': + + setup( + name=NAME, + version=findversion(NS, NAME), + license=LICENSE, + namespace_packages=[NS], # home for our libraries + packages=find_packages(exclude=['tests']), + author=AUTHOR, + author_email=EMAIL, + description=DESC, + long_description=open('README.rst').read(), + url=URL, + classifiers=CLASS, + keywords=TAGS, + + # run-time dependencies + install_requires=REQUIRE, + + extras_require={ + }, + + package_data={ + }, + + data_files=[], + + entry_points={ + }, + ) +