diff --git a/fabfile.py b/fabfile.py deleted file mode 100644 index abe38da..0000000 --- a/fabfile.py +++ /dev/null @@ -1,8 +0,0 @@ -__author__ = 'Taio' - -from fabric.api import local - - -def deploy_playback(): - local('python setup.py install') - diff --git a/install.py b/install.py new file mode 100644 index 0000000..f3501d4 --- /dev/null +++ b/install.py @@ -0,0 +1,45 @@ +# The MIT License (MIT) +# +# Copyright (c) 2015 Taio Jia (jiasir) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +__author__ = 'jiasir(Taio)' + +import os +import shutil + +try: + from fabric.api import local +except ImportError: + os.system('python setup.py install') + + +def copy_tools(): + if not os.path.exists('/etc/playback'): + os.mkdir('/etc/playback') + shutil.copy('inventory/inventory_ha', '/etc/playback/playback.conf') + + +def deploy_playback(): + local('python setup.py install') + copy_tools() + +if __name__ == '__main__': + deploy_playback() diff --git a/setup.py b/setup.py index ac6abf5..f3766e0 100644 --- a/setup.py +++ b/setup.py @@ -21,8 +21,7 @@ # SOFTWARE. import sys -import os -import shutil + try: from setuptools import setup, find_packages @@ -46,8 +45,3 @@ 'bin/playback', ], data_files=[],) - -if not os.path.exists('/etc/playback'): - os.mkdir('/etc/playback') - -shutil.copy('inventory/inventory', '/etc/playback/playback.conf')