From c8c04232d63f1ca0bd85e4b7b3f67dd4eb8ab917 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Thu, 13 Nov 2014 11:10:38 -0800 Subject: [PATCH] setup.py 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 --- setup.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..682b4af --- /dev/null +++ b/setup.py @@ -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 , " + "Sean Olson ", + license='MIT', + packages=['peru'], + package_data={'peru': resources_paths}, + scripts=['bin/peru'], + install_requires=[ + 'docopt', + 'PyYAML', + ], +)