In the spirit of do not reinvent the wheel, there are lots of way to automate builds with python, getting for free things like dependencies management.
One useful tool is doit.
To get an idea, this is a very simple example similar to your use case:
import os
MY_PRJ_ROOT='/home/myname/my_project_dir'
def task_cd():
def cd_to_somewhere():
os.chdir(MY_PRJ_ROOT)
return {
'actions': [cd_to_somewhere]
}
def task_git_pull():
"""pull my git repo"""
return {
'actions': ['git pull'],
}
def task_build_rust_app():
"""build by awesome rust app"""
return {
'actions': ['cargo build']
}
supposing the above is a file named dodo.py
, the default name for doit tasks, run it as:
> doit
Others resources
Also worth noting (to my knowledge, they are not an exhaustive list of pythons automation tools):
SCons - a software construction tool
ShutIt - A versatile automation framework