Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py to build and install the package underneath #338

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,30 @@
from ssm import __version__


def setup_temp_files():
"""Create temporary files with deployment names. """
copyfile('bin/receiver.py', 'bin/ssmreceive')
copyfile('bin/sender.py', 'bin/ssmsend')
copyfile('scripts/apel-ssm.logrotate', 'conf/apel-ssm')
copyfile('README.md', 'apel-ssm')


def main():
"""Called when run as script, e.g. 'python setup.py install'."""
# Create temporary files with deployment names
if 'install' in sys.argv:
copyfile('bin/receiver.py', 'bin/ssmreceive')
copyfile('bin/sender.py', 'bin/ssmsend')
copyfile('scripts/apel-ssm.logrotate', 'conf/apel-ssm')
copyfile('README.md', 'apel-ssm')
supported_commands = {
"install",
"build",
"bdist",
"develop",
"build_scripts",
"install_scripts",
"install_data",
"bdist_dumb",
"bdist_egg",
}

if supported_commands.intersection(sys.argv):
setup_temp_files()

# conf_files will later be copied to conf_dir
conf_dir = '/etc/apel/'
Expand Down Expand Up @@ -79,7 +95,7 @@ def main():
)

# Remove temporary files with deployment names
if 'install' in sys.argv:
if supported_commands.intersection(sys.argv):
remove('bin/ssmreceive')
remove('bin/ssmsend')
remove('conf/apel-ssm')
Expand Down