Skip to content

Commit

Permalink
Update setup.py flow to perform basic setup standard commands
Browse files Browse the repository at this point in the history
Now, `setup.py` will make use of the build step to install the package. Enabling separate flows for the build and install phases if specified.

We are currently NOT supporting a few standard commands that are out of scope or NOT being asked, listed below:
- `register`, `bdist_rpm`, `bdist_wininst`, `upload`.

Also, We do NOT support extra commands with the setup.py except a few commands like `develop`, `egg_info`, and `bdist_egg`.
  • Loading branch information
“Sae126V” authored and tofu-rocketry committed May 21, 2024
1 parent e3f5c81 commit 0e8592b
Showing 1 changed file with 23 additions and 7 deletions.
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

0 comments on commit 0e8592b

Please sign in to comment.