diff --git a/Makefile b/Makefile index 7fa62cb249..d024e9303b 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ COMPONENTS_TEST := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS), PYTHON_TARGET := 2.7 -REQUIREMENTS := requirements.txt test-requirements.txt st2client/requirements.txt +REQUIREMENTS := requirements.txt test-requirements.txt PIP_OPTIONS := $(ST2_PIP_OPTIONS) @@ -168,6 +168,8 @@ requirements: virtualenv $(REQUIREMENTS) @echo @echo "==================== requirements ====================" @echo + # Merge into one st2 components-wide requirements.txt file. + python ./scripts/fixate-requirements.py -s st2*/in-requirements.txt -f fixed-requirements.txt for req in $(REQUIREMENTS); do \ echo "Installing $$req..." ; \ . $(VIRTUALENV_DIR)/bin/activate && pip install $(PIP_OPTIONS) $$req ; \ diff --git a/fixed-requirements.txt b/fixed-requirements.txt new file mode 100644 index 0000000000..d6b0390933 --- /dev/null +++ b/fixed-requirements.txt @@ -0,0 +1,18 @@ +# Packages versions fixed for the whole st2 stack +eventlet>=0.13.0 +six==1.9.0 +apscheduler>=3.0.0rc1 +eventlet>=0.13.0 +gitpython==0.3.2.1 +jsonschema>=2.3.0 +mongoengine>=0.8.7,<0.9 +pecan==0.7.0 +pymongo<3.0 +six==1.9.0 +passlib>=1.6.2,<1.7 +lockfile>=0.10.2,<0.11 +python-gnupg>=0.3.7,<0.4 +jsonpath-rw>=1.3.0 +pyinotify>=0.9.5,<=0.10 +python-nmap>=0.3.4,<0.4 +semver>=2.1.2 diff --git a/requirements.txt b/requirements.txt index 3641121fc6..eff146d367 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +# 1. Don't include forget to populate spcific requirements.txt. IMORTANT!!! +# 2. Don't include setuptools into any of requirements.txt (we don't want it bundled). apscheduler>=3.0.0rc1 eventlet>=0.13.0 flask @@ -15,11 +17,10 @@ python-dateutil python-json-logger pyyaml requests -setuptools==11.1 six==1.9.0 tooz -git+https://github.com/StackStorm/python-mistralclient.git@st2-0.9.0 -git+https://github.com/StackStorm/fabric.git@stanley-patched +git+https://github.com/StackStorm/python-mistralclient.git@st2-0.9.0#egg=python-mistralclient +git+https://github.com/StackStorm/fabric.git@stanley-patched#egg=fabric passlib>=1.6.2,<1.7 lockfile>=0.10.2,<0.11 python-gnupg>=0.3.7,<0.4 @@ -27,7 +28,7 @@ jsonpath-rw>=1.3.0 # Requirements for linux pack # used by file watcher sensor pyinotify>=0.9.5,<=0.10 --e git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper +git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper # used by nmap actions python-nmap>=0.3.4,<0.4 semver>=2.1.2 diff --git a/scripts/fixate-requirements.py b/scripts/fixate-requirements.py new file mode 100644 index 0000000000..e187061551 --- /dev/null +++ b/scripts/fixate-requirements.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +This script is used to automate generation of requirements.txt +for st2 components. + +The idea behind this script is that that each component has it's own requirements +in-requirements.txt file (input requirements file). Except this file +there's also the top-level fixed-requirements.txt which pins production versions +for the whole st2 stack. During production use (building, packaging, etc) +requirements.txt is generated from in-requirements.txt where version of packages are +fixed according to fixed-requirements.txt. +""" + +import argparse +import os +import os.path +import sys +from distutils.version import StrictVersion + +OSCWD = os.path.abspath(os.curdir) +GET_PIP = ' curl https://bootstrap.pypa.io/get-pip.py | python' + +try: + import pip + from pip.req import parse_requirements +except ImportError: + print 'Download pip:\n', GET_PIP + sys.exit(1) + + +def parse_args(): + parser = argparse.ArgumentParser(description='Tool for requirements.txt generation.') + parser.add_argument('-s', '--source-requirements', nargs='+', + required=True, + help='Specifiy paths to requirements file(s). ' + 'In case severasl requirements files are given their content is merged.') + parser.add_argument('-f', '--fixed-requirements', required=True, + help='Specifiy path to fixed-requirements.txt file.') + parser.add_argument('-o', '--output-file', default='requirements.txt', + help='Specifiy path to the resulting requirements file.') + if len(sys.argv) < 2: + parser.print_help() + sys.exit(1) + return vars(parser.parse_args()) + + +def check_pip_version(): + if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): + print "Upgrade pip, your version `{}' "\ + "is outdated:\n".format(pip.__version__), GET_PIP + sys.exit(1) + + +def load_requirements(file_path): + return tuple((r for r in parse_requirements(file_path, session=False))) + + +def locate_file(path, must_exist=False): + if not os.path.isabs(path): + path = os.path.join(OSCWD, path) + if must_exist and not os.path.isfile(path): + print("Error: couldn't locate file `{}'".format(path)) + return path + + +def merge_source_requirements(sources): + """Read requirements source files and merge it's content. + """ + projects = set() + merged_requirements = [] + for infile_path in (locate_file(p, must_exist=True) for p in sources): + for req in load_requirements(infile_path): + # Requirements lines like "project[version_spec]" + if req.req: + # Skip already added project name + if req.req.project_name in projects: + continue + projects.add(req.req.project_name) + merged_requirements.append(req) + + # Requirements lines like "vcs+proto://url" + elif req.link: + merged_requirements.append(req) + else: + raise RuntimeError('Unexpected requirement {}'.format(req)) + + return merged_requirements + + +def write_requirements(sources=None, fixed_requirements=None, output_file=None): + """Wrire resulting requirements taking versions from the fixed_requirements. + """ + requirements = merge_source_requirements(sources) + fixed = load_requirements(locate_file(fixed_requirements, must_exist=True)) + fixedreq_hash = {req.req.project_name: req for req in fixed if req.req} + + with open(output_file, 'w') as f: + f.write("# Don't edit this file. It's generated automatically!\n") + links = set() + for req in requirements: + # we don't have any idea how to process links, so just add them + if req.link and req.link not in links: + links.add(req.link) + rline = str(req.link) + elif req.req: + project = req.req.project_name + if project in fixedreq_hash: + rline = str(fixedreq_hash[project].req) + else: + rline = str(req.req) + f.write(rline + '\n') + + return + + +if __name__ == '__main__': + check_pip_version() + args = parse_args() + write_requirements(sources=args['source_requirements'], + fixed_requirements=args['fixed_requirements'], + output_file=args['output_file']) diff --git a/st2_version b/st2_version new file mode 100644 index 0000000000..df39e58274 --- /dev/null +++ b/st2_version @@ -0,0 +1 @@ +0.10.dev1 diff --git a/st2actions/MANIFEST.in b/st2actions/MANIFEST.in index 8226a3afaa..28556e968b 100644 --- a/st2actions/MANIFEST.in +++ b/st2actions/MANIFEST.in @@ -1 +1,4 @@ -recursive-include * +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2actions *.* * diff --git a/st2actions/Makefile b/st2actions/Makefile index a628108d88..1543b5920e 100644 --- a/st2actions/Makefile +++ b/st2actions/Makefile @@ -42,3 +42,6 @@ deb: pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd cp -f ~/$(COMPONENT)*.deb ~/debbuild/ +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2actions/in-requirements.txt b/st2actions/in-requirements.txt new file mode 100644 index 0000000000..0f93ce1bbe --- /dev/null +++ b/st2actions/in-requirements.txt @@ -0,0 +1,11 @@ +apscheduler +python-dateutil +eventlet +git+https://github.com/StackStorm/fabric.git@stanley-patched#egg=fabric +jinja2 +kombu +git+https://github.com/StackStorm/python-mistralclient.git@st2-0.9.0#egg=python-mistralclient +oslo.config +requests +six +pyyaml diff --git a/st2actions/setup.py b/st2actions/setup.py index 2a83d35251..ecdd6340d1 100644 --- a/st2actions/setup.py +++ b/st2actions/setup.py @@ -14,24 +14,43 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages +import os.path +from pip.req import parse_requirements +from setuptools import setup, find_packages + + +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() + +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) + setup( - name='st2actions', - version='0.4.0', - description='', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - install_requires=[ - "pecan", - ], - test_suite='st2actions', + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, zip_safe=False, include_package_data=True, - packages=find_packages(exclude=['ez_setup']) + packages=find_packages(exclude=['setuptools', 'tests']), + scripts=[ + 'bin/st2actionrunner', + 'bin/st2notifier', + 'bin/st2resultstracker' + ] ) diff --git a/st2api/MANIFEST.in b/st2api/MANIFEST.in index c922f11ad7..27c6005d1c 100644 --- a/st2api/MANIFEST.in +++ b/st2api/MANIFEST.in @@ -1 +1,4 @@ -recursive-include public * +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2api *.* * diff --git a/st2api/Makefile b/st2api/Makefile index 15ced17adb..a7737297a9 100644 --- a/st2api/Makefile +++ b/st2api/Makefile @@ -40,3 +40,6 @@ deb: pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd cp -f ~/$(COMPONENT)*.deb ~/debbuild/ +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2api/in-requirements.txt b/st2api/in-requirements.txt new file mode 100644 index 0000000000..0e6cc0f013 --- /dev/null +++ b/st2api/in-requirements.txt @@ -0,0 +1,7 @@ +eventlet +jsonschema +kombu +mongoengine +oslo.config +pecan +six diff --git a/st2api/setup.cfg b/st2api/setup.cfg deleted file mode 100644 index 8436704bc2..0000000000 --- a/st2api/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[nosetests] -match=^st2api -where=test -nocapture=1 -cover-package=st2api -cover-erase=1 diff --git a/st2api/setup.py b/st2api/setup.py index 2f14aa3955..7b5ba2a82f 100644 --- a/st2api/setup.py +++ b/st2api/setup.py @@ -14,27 +14,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages +import os.path +from pip.req import parse_requirements +from setuptools import setup, find_packages + + +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() + +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) + setup( - name='st2api', - version='0.4.0', - description='', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - install_requires=[ - "pecan", - ], - package_data={ - 'st2api': ['templates/*.html'] - }, - test_suite='st2api', + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, zip_safe=False, include_package_data=True, - packages=find_packages(exclude=['ez_setup']) + packages=find_packages(exclude=['setuptools', 'tests']), + scripts=[ + 'bin/st2api' + ] ) diff --git a/st2auth/MANIFEST.in b/st2auth/MANIFEST.in index c922f11ad7..440a6b8741 100644 --- a/st2auth/MANIFEST.in +++ b/st2auth/MANIFEST.in @@ -1 +1,4 @@ -recursive-include public * +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2auth *.* * diff --git a/st2auth/Makefile b/st2auth/Makefile index 95b54583ec..e117fd0899 100644 --- a/st2auth/Makefile +++ b/st2auth/Makefile @@ -39,3 +39,7 @@ deb: tar --transform=s~^~$(COMPONENTS)-$(VER)/~ -czf ~/$(COMPONENTS).tar.gz bin conf $(COMPONENTS) packaging/debian pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd cp -f ~/$(COMPONENT)*.deb ~/debbuild/ + +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2auth/in-requirements.txt b/st2auth/in-requirements.txt new file mode 100644 index 0000000000..38727eda5a --- /dev/null +++ b/st2auth/in-requirements.txt @@ -0,0 +1,6 @@ +eventlet +oslo.config +passlib +pecan +pymongo +six diff --git a/st2auth/setup.py b/st2auth/setup.py index 675c1dbe22..03d559975b 100644 --- a/st2auth/setup.py +++ b/st2auth/setup.py @@ -14,24 +14,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages +import os.path +from pip.req import parse_requirements +from setuptools import setup, find_packages + + +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() + +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) + setup( - name='st2auth', - version='0.4.0', - description='', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - install_requires=[ - "pecan", - ], - test_suite='st2auth', + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, zip_safe=False, include_package_data=True, - packages=find_packages(exclude=['ez_setup']) + packages=find_packages(exclude=['setuptools', 'tests']), + scripts=[ + 'bin/st2auth' + ] ) diff --git a/st2client/MANIFEST.in b/st2client/MANIFEST.in index a7da3fcb49..84aa989c43 100644 --- a/st2client/MANIFEST.in +++ b/st2client/MANIFEST.in @@ -1,2 +1,5 @@ -include requirements.txt +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2client *.* * include LICENSE diff --git a/st2client/Makefile b/st2client/Makefile index 98306062fa..f05583d14d 100644 --- a/st2client/Makefile +++ b/st2client/Makefile @@ -31,3 +31,7 @@ deb: mkdir -p ~/debbuild cp deb_dist/python-$(COMPONENTS)*-1_all.deb ~/debbuild/$(COMPONENTS)_$(VER)-$(RELEASE)_amd64.deb rm -Rf dist deb_dist $(COMPONENTS)-$(VER).tar.gz $(COMPONENTS).egg-info ChangeLog AUTHORS build + +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2client/requirements.txt b/st2client/in-requirements.txt similarity index 100% rename from st2client/requirements.txt rename to st2client/in-requirements.txt index 32915d0deb..80564f1e64 100644 --- a/st2client/requirements.txt +++ b/st2client/in-requirements.txt @@ -1,6 +1,6 @@ prettytable +python-dateutil pyyaml +jsonpath-rw requests six -python-dateutil -jsonpath-rw diff --git a/st2client/setup.py b/st2client/setup.py index 963a4a4dbb..b3d508d334 100644 --- a/st2client/setup.py +++ b/st2client/setup.py @@ -14,55 +14,40 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys - +import os.path +from pip.req import parse_requirements from setuptools import setup, find_packages -PKG_ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) -PKG_REQ_FILE = '%s/requirements.txt' % PKG_ROOT_DIR -os.chdir(PKG_ROOT_DIR) - - -def get_version_string(): - version = None - sys.path.insert(0, PKG_ROOT_DIR) - from st2client import __version__ - version = __version__ - sys.path.pop(0) - return version - +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) -def get_requirements(): - with open(PKG_REQ_FILE) as f: - required = f.read().splitlines() +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() - # Ignore comments in the requirements file - required = [line for line in required if not line.startswith('#')] - return required +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) setup( - name='st2client', - version=get_version_string(), - description='CLI and python client library for the StackStorm (st2) automation platform.', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - url='http://www.stackstorm.com', - packages=find_packages(exclude=['tests']), - install_requires=get_requirements(), - license='Apache License (2.0)', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Information Technology', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7' - ], + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, + zip_safe=False, + include_package_data=True, + packages=find_packages(exclude=['setuptools', 'tests']), entry_points={ 'console_scripts': [ 'st2 = st2client.shell:main' diff --git a/st2common/MANIFEST.in b/st2common/MANIFEST.in new file mode 100644 index 0000000000..1bad7eda3c --- /dev/null +++ b/st2common/MANIFEST.in @@ -0,0 +1,4 @@ +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2common *.* * diff --git a/st2common/Makefile b/st2common/Makefile index 5286d87e39..2705503528 100644 --- a/st2common/Makefile +++ b/st2common/Makefile @@ -32,3 +32,7 @@ deb: tar --transform=s~^~$(COMPONENTS)-$(VER)/~ --exclude=correlation -czf ~/$(COMPONENTS).tar.gz bin st2 logrotate.d $(COMPONENTS) ../contrib ../docs ../tools/ ../requirements.txt packaging/debian pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd cp -f ~/$(COMPONENT)*.deb ~/debbuild/ + +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2common/in-requirements.txt b/st2common/in-requirements.txt new file mode 100644 index 0000000000..b31e10f562 --- /dev/null +++ b/st2common/in-requirements.txt @@ -0,0 +1,15 @@ +python-dateutil +eventlet +git+https://github.com/StackStorm/fabric.git@stanley-patched#egg=fabric +jinja2 +jsonschema +kombu +mongoengine +oslo.config +paramiko +pecan +pyyaml +requests +semver +six +tooz diff --git a/st2common/setup.cfg b/st2common/setup.cfg deleted file mode 100644 index db93e88ae7..0000000000 --- a/st2common/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[nosetests] -match=^st2common -where=test -nocapture=1 -cover-package=st2common -cover-erase=1 diff --git a/st2common/setup.py b/st2common/setup.py index ba51c78775..da59a3b316 100644 --- a/st2common/setup.py +++ b/st2common/setup.py @@ -14,24 +14,45 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages +# Just setup pip before using with a command: +# curl https://bootstrap.pypa.io/get-pip.py | python + +import os.path +from pip.req import parse_requirements +from setuptools import setup, find_packages + + +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() + +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) + setup( - name='st2common', - version='0.4.0', - description='', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - install_requires=[ - "pecan", - ], - test_suite='st2common', + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, zip_safe=False, include_package_data=True, - packages=find_packages(exclude=['ez_setup']) + packages=find_packages(exclude=['setuptools', 'tests']), + scripts=[ + 'bin/st2-bootstrap-rmq', + 'bin/st2-register-content' + ] ) diff --git a/st2debug/MANIFEST.in b/st2debug/MANIFEST.in new file mode 100644 index 0000000000..4460d8dcc6 --- /dev/null +++ b/st2debug/MANIFEST.in @@ -0,0 +1,4 @@ +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2debug *.* * diff --git a/st2debug/Makefile b/st2debug/Makefile index 86719900e0..653b694e30 100644 --- a/st2debug/Makefile +++ b/st2debug/Makefile @@ -39,3 +39,7 @@ deb: tar --transform=s~^~$(COMPONENTS)-$(VER)/~ -czf ~/$(COMPONENTS).tar.gz bin $(COMPONENTS) packaging/debian pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd cp -f ~/$(COMPONENT)*.deb ~/debbuild/ + +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2debug/in-requirements.txt b/st2debug/in-requirements.txt new file mode 100644 index 0000000000..96ec4e8977 --- /dev/null +++ b/st2debug/in-requirements.txt @@ -0,0 +1,4 @@ +python-gnupg +requests +six +pyyaml diff --git a/st2debug/setup.py b/st2debug/setup.py index 69af675475..dd43fd3e83 100644 --- a/st2debug/setup.py +++ b/st2debug/setup.py @@ -14,21 +14,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages +import os.path +from pip.req import parse_requirements +from setuptools import setup, find_packages + + +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() + +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) + setup( - name='st2debug', - version='0.4.0', - description='', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - test_suite='st2debug', + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, zip_safe=False, include_package_data=True, - packages=find_packages(exclude=['ez_setup']) + packages=find_packages(exclude=['setuptools', 'tests']), + scripts=[ + 'bin/st2-submit-debug-info' + ] ) diff --git a/st2reactor/MANIFEST.in b/st2reactor/MANIFEST.in new file mode 100644 index 0000000000..9baa625501 --- /dev/null +++ b/st2reactor/MANIFEST.in @@ -0,0 +1,4 @@ +# https://docs.python.org/2/distutils/sourcedist.html#commands +# Include all files under the source tree by default. +# Another behaviour can be used in the future though. +recursive-include st2reactor *.* * diff --git a/st2reactor/Makefile b/st2reactor/Makefile index e1a85c2051..8320f229c9 100644 --- a/st2reactor/Makefile +++ b/st2reactor/Makefile @@ -26,3 +26,6 @@ deb: pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd cp -f ~/$(COMPONENT)*.deb ~/debbuild/ +.PHONY: requirements +requirements: + python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt diff --git a/st2reactor/in-requirements.txt b/st2reactor/in-requirements.txt new file mode 100644 index 0000000000..36144736e8 --- /dev/null +++ b/st2reactor/in-requirements.txt @@ -0,0 +1,8 @@ +apscheduler +python-dateutil +eventlet +jsonpath-rw +jsonschema +kombu +oslo.config +six diff --git a/st2reactor/setup.py b/st2reactor/setup.py index 77b0757a74..bdefff9bf3 100644 --- a/st2reactor/setup.py +++ b/st2reactor/setup.py @@ -14,24 +14,44 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages +import os.path +from pip.req import parse_requirements +from setuptools import setup, find_packages + + +def fetch_requirements(): + links = [] + reqs = [] + for req in parse_requirements('requirements.txt', session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(current_dir, 'st2_version'), 'r') as f: + st2_version = f.read().strip() + +install_reqs, dep_links = fetch_requirements() +st2_component = os.path.basename(current_dir) + setup( - name='st2reactor', - version='0.4.0', - description='', + name=st2_component, + version=st2_version, + description='{} component'.format(st2_component), author='StackStorm', author_email='info@stackstorm.com', - install_requires=[ - "pecan", - ], - test_suite='st2reactor', + install_requires=install_reqs, + dependency_links=dep_links, + test_suite=st2_component, zip_safe=False, include_package_data=True, - packages=find_packages(exclude=['ez_setup']) + packages=find_packages(exclude=['setuptools', 'tests']), + scripts=[ + 'bin/st2-rule-tester', + 'bin/st2-trigger-refire', + 'bin/st2rulesengine', + 'bin/st2sensorcontainer' + ] )