diff --git a/Makefile b/Makefile index a51112016a..beeb01b132 100644 --- a/Makefile +++ b/Makefile @@ -183,7 +183,7 @@ distclean: clean rm -rf $(VIRTUALENV_DIR) .PHONY: requirements -requirements: virtualenv +requirements: virtualenv .sdist-requirements @echo @echo "==================== requirements ====================" @echo @@ -354,3 +354,18 @@ debs: rm -Rf ~/debbuild $(foreach COM,$(COMPONENTS), pushd $(COM); make deb; popd;) pushd st2client && make deb && popd + +# >>>> +.PHONY: .sdist-requirements +.sdist-requirements: + # Copy over shared dist utils module which is needed by setup.py + @for component in $(COMPONENTS_TEST); do\ + cp -f ./scripts/dist_utils.py $$component/dist_utils.py;\ + done + + # Copy over CHANGELOG.RST, CONTRIBUTING.RST and LICENSE file to each component directory + #@for component in $(COMPONENTS_TEST); do\ + # test -s $$component/README.rst || cp -f README.rst $$component/; \ + # cp -f CONTRIBUTING.rst $$component/; \ + # cp -f LICENSE $$component/; \ + #done diff --git a/st2actions/MANIFEST.in b/st2actions/MANIFEST.in index f9153101be..bd4e0f2730 100644 --- a/st2actions/MANIFEST.in +++ b/st2actions/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2actions *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2actions/dist_utils.py b/st2actions/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2actions/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2actions/setup.py b/st2actions/setup.py index 0669f5c34a..0a8c26ea51 100644 --- a/st2actions/setup.py +++ b/st2actions/setup.py @@ -15,27 +15,20 @@ # limitations under the License. import os.path -from pip.req import parse_requirements + from setuptools import setup, find_packages + +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround from st2actions import __version__ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ST2_COMPONENT = os.path.basename(BASE_DIR) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) -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) - -install_reqs, dep_links = fetch_requirements() - - +apply_vagrant_workaround() setup( name=ST2_COMPONENT, version=__version__, diff --git a/st2api/MANIFEST.in b/st2api/MANIFEST.in index 0990b824ac..80fce4bcb8 100644 --- a/st2api/MANIFEST.in +++ b/st2api/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2api *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2api/dist_utils.py b/st2api/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2api/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2api/setup.py b/st2api/setup.py index c68ccb3536..23a02e46ba 100644 --- a/st2api/setup.py +++ b/st2api/setup.py @@ -15,8 +15,11 @@ # limitations under the License. import os.path -from pip.req import parse_requirements + from setuptools import setup, find_packages + +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround from st2api import __version__ @@ -24,19 +27,9 @@ ST2_COMPONENT = os.path.basename(BASE_DIR) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) -def fetch_requirements(): - links = [] - reqs = [] - for req in parse_requirements(REQUIREMENTS_FILE, session=False): - if req.link: - links.append(str(req.link)) - reqs.append(str(req.req)) - return (reqs, links) - -install_reqs, dep_links = fetch_requirements() - - +apply_vagrant_workaround() setup( name=ST2_COMPONENT, version=__version__, diff --git a/st2auth/MANIFEST.in b/st2auth/MANIFEST.in index 54028a1e73..320363daf2 100644 --- a/st2auth/MANIFEST.in +++ b/st2auth/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2auth *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2auth/dist_utils.py b/st2auth/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2auth/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2auth/setup.py b/st2auth/setup.py index ea7a54cec7..8ae4dfa5b6 100644 --- a/st2auth/setup.py +++ b/st2auth/setup.py @@ -15,27 +15,21 @@ # limitations under the License. import os.path -from pip.req import parse_requirements + from setuptools import setup, find_packages + +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround from st2auth import __version__ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ST2_COMPONENT = os.path.basename(BASE_DIR) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') - -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) - -install_reqs, dep_links = fetch_requirements() +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) +apply_vagrant_workaround() setup( name=ST2_COMPONENT, version=__version__, diff --git a/st2client/MANIFEST.in b/st2client/MANIFEST.in index 2990ce46c4..1e7c0e9c99 100644 --- a/st2client/MANIFEST.in +++ b/st2client/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2client *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2client/dist_utils.py b/st2client/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2client/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2client/setup.py b/st2client/setup.py index 8b7d7100c8..e6b18ca52e 100644 --- a/st2client/setup.py +++ b/st2client/setup.py @@ -16,28 +16,19 @@ import os.path -from pip.req import parse_requirements from setuptools import setup, find_packages +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround from st2client import __version__ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ST2_COMPONENT = os.path.basename(BASE_DIR) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) -def fetch_requirements(): - links = [] - reqs = [] - for req in parse_requirements(REQUIREMENTS_FILE, session=False): - if req.link: - links.append(str(req.link)) - reqs.append(str(req.req)) - return (reqs, links) - -install_reqs, dep_links = fetch_requirements() - - +apply_vagrant_workaround() setup( name=ST2_COMPONENT, version=__version__, diff --git a/st2common/MANIFEST.in b/st2common/MANIFEST.in index 644e8c9568..990cbf0bb5 100644 --- a/st2common/MANIFEST.in +++ b/st2common/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2common *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2common/dist_utils.py b/st2common/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2common/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2common/setup.py b/st2common/setup.py index cf5ab84a82..74f7f9d9e6 100644 --- a/st2common/setup.py +++ b/st2common/setup.py @@ -15,27 +15,20 @@ # limitations under the License. import os.path -from pip.req import parse_requirements + from setuptools import setup, find_packages + +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround from st2common import __version__ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ST2_COMPONENT = os.path.basename(BASE_DIR) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) -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) - -install_reqs, dep_links = fetch_requirements() - - +apply_vagrant_workaround() setup( name=ST2_COMPONENT, version=__version__, diff --git a/st2debug/MANIFEST.in b/st2debug/MANIFEST.in index f223aea675..7c768ffda6 100644 --- a/st2debug/MANIFEST.in +++ b/st2debug/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2debug *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2debug/dist_utils.py b/st2debug/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2debug/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2exporter/MANIFEST.in b/st2exporter/MANIFEST.in index 99e8075f3a..0f98c7b8ea 100644 --- a/st2exporter/MANIFEST.in +++ b/st2exporter/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2exporter *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2exporter/dist_utils.py b/st2exporter/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2exporter/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2reactor/MANIFEST.in b/st2reactor/MANIFEST.in index fdb181e2c4..43049aea86 100644 --- a/st2reactor/MANIFEST.in +++ b/st2reactor/MANIFEST.in @@ -2,6 +2,7 @@ # Include all files under the source tree by default. # Another behaviour can be used in the future though. recursive-include st2reactor *.* * +include dist_utils.py include requirements.txt include README.rst include CHANGELOG.rst diff --git a/st2reactor/dist_utils.py b/st2reactor/dist_utils.py new file mode 100644 index 0000000000..c8397bb62a --- /dev/null +++ b/st2reactor/dist_utils.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# 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. + +import os + +from pip.req import parse_requirements + +__all__ = [ + 'fetch_requirements', + 'apply_vagrant_workaround' +] + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + if req.link: + links.append(str(req.link)) + reqs.append(str(req.req)) + return (reqs, links) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link diff --git a/st2reactor/setup.py b/st2reactor/setup.py index 829769d3f8..3095b85af9 100644 --- a/st2reactor/setup.py +++ b/st2reactor/setup.py @@ -15,29 +15,20 @@ # limitations under the License. import os.path -from pip.req import parse_requirements + from setuptools import setup, find_packages + +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround from st2reactor import __version__ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ST2_COMPONENT = os.path.basename(BASE_DIR) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) -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__)) -st2_component = os.path.basename(current_dir) -install_reqs, dep_links = fetch_requirements() - - +apply_vagrant_workaround() setup( name=ST2_COMPONENT, version=__version__,