Summary:
Create a simple setup.py file from the instructions at
https://packaging.python.org/en/latest/distributing.html. The
`package_data` field doesn't seem to like directories, so we need to
walk the paths under `./peru/resources` to include everything.

Right now we're not including anything under third_party. Instead we
pull those in as dependencies from PyPI. Not sure if this is what we'll
do in the long term, but it's nice that it works.

Test Plan:
Ran `python3 setup.py install --user` and confirmed that peru works.
Then `cd tests; python3 -m unittest` to confirm that tests pass against
the installed version.

Reviewers: sean

Reviewed By: sean

Differential Revision: https://phabricator.buildinspace.com/D125
This commit is contained in:
Jack O'Connor 2014-11-13 11:10:38 -08:00
parent 021e36861b
commit c8c04232d6
1 changed files with 31 additions and 0 deletions

31
setup.py Normal file
View File

@ -0,0 +1,31 @@
import os
import setuptools
# Written according to the docs at
# https://packaging.python.org/en/latest/distributing.html
# Get the list of all filepaths under ./peru/resources/, relative to ./peru/.
peru_module_dir = os.path.join(os.path.dirname(__file__), 'peru')
resources_dir = os.path.join(peru_module_dir, 'resources')
resources_paths = []
for dirpath, dirnames, filenames in os.walk(resources_dir):
relpaths = [os.path.relpath(os.path.join(dirpath, f),
start=peru_module_dir)
for f in filenames]
resources_paths.extend(relpaths)
setuptools.setup(
name='peru',
version='0.1.0',
url='https://github.com/buildinspace/peru',
author="Jack O'Connor <oconnor663@gmail.com>, "
"Sean Olson <olson.sean.k@gmail.com>",
license='MIT',
packages=['peru'],
package_data={'peru': resources_paths},
scripts=['bin/peru'],
install_requires=[
'docopt',
'PyYAML',
],
)