diff --git a/.gitignore b/.gitignore index 68df9fc..3593070 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ config.yml __pycache__/ +*.pyc +s3pd.egg-info/ +build/ +dist/ diff --git a/s3pd/__init__.py b/s3pd/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/load_config.py b/s3pd/load_config.py similarity index 100% rename from load_config.py rename to s3pd/load_config.py diff --git a/pull-deploy.py b/s3pd/pull_deploy.py similarity index 99% rename from pull-deploy.py rename to s3pd/pull_deploy.py index c6c3aed..8b0b419 100644 --- a/pull-deploy.py +++ b/s3pd/pull_deploy.py @@ -11,7 +11,7 @@ import yaml import argparse -import load_config +from .load_config import get_config # These seem fair to set as globals; they could be put into the config file # as new options with a default override for backwards compatibility @@ -260,7 +260,7 @@ def send_sns_log(message, arn): def pull(cfg_file): - cfg = load_config.get_config(cfg_file) + cfg = get_config(cfg_file) response = requests.get('http://169.254.169.254/latest/meta-data/instance-id') instance_id = response.text @@ -285,7 +285,7 @@ def pull(cfg_file): def show(cfg_file): log("Showing config from path: "+cfg_file) - cfg = load_config.get_config(cfg_file) + cfg = get_config(cfg_file) print(cfg) diff --git a/push-deploy.py b/s3pd/push_deploy.py similarity index 95% rename from push-deploy.py rename to s3pd/push_deploy.py index 7a4f409..0404597 100644 --- a/push-deploy.py +++ b/s3pd/push_deploy.py @@ -10,7 +10,7 @@ import sys import argparse -import load_config +from .load_config import get_config def log(msg): now = datetime.datetime.now() @@ -20,7 +20,7 @@ def log(msg): def deploy(deploy, cfg_file): - cfg = load_config.get_config(cfg_file) + cfg = get_config(cfg_file) date_string = datetime.datetime.today().strftime("%Y-%m-%d_%H-%M-%S") timestamp = int(time.time()) @@ -45,7 +45,7 @@ def deploy(deploy, cfg_file): def show(cfg_file): log("Showing config from path: "+cfg_file) - cfg = load_config.get_config(cfg_file) + cfg = get_config(cfg_file) print(cfg) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2df7f91 --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +import os +from setuptools import setup, find_packages + + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +setup( + name="s3pd", + version="0.1.0", + author="Mike Lehan", + description="Tool to syncronise deployments from S3 onto multiple EC2 instances", + license="MIT", + keywords=[], + url="", + packages=find_packages(), + requires=[ + 'boto3', + 'requests', + 'PyYAML', + ], + long_description=read('README.md'), + entry_points={ + 'console_scripts': [ + 'pull-deploy = as3pd.pull_deploy:main', + 'push-deploy = as3pd.push_deploy:main', + ] + }, +)