Skip to content

Instantly share code, notes, and snippets.

@chhantyal
Last active October 7, 2018 13:02
Show Gist options
  • Save chhantyal/73b5a11b1f6a82e3d9057e38acd99f08 to your computer and use it in GitHub Desktop.
Save chhantyal/73b5a11b1f6a82e3d9057e38acd99f08 to your computer and use it in GitHub Desktop.
Build single egg distribution from multiple Python packages (source files only for now). It's a CRAZY idea, don't try at home or work πŸ˜‚
#!/bin/bash
# Idea to copy all source files (packages in different repos) in once place
# and use setup.py located in project to build single egg file.
temp_dir=/tmp/ira/
curr_dir=$(pwd)
dist_dir=${curr_dir}/dist/
# Copy project to a dir
rm -rf ${temp_dir}
cp -rf . ${temp_dir}
# Copy source dependencies to same dir
echo "Cloning from remote Git"
git clone https://github.com/viessmann/logger.git ${temp_dir}/logger_tmp
cp -rf ${temp_dir}/logger_tmp/logger/ ${temp_dir}logger
# Use project setup.py to run bdist_egg
echo "Running build"
cd ${temp_dir} && python setup.py bdist_egg
# Copy built egg file to original location
mkdir -p ${dist_dir} && cp -rf dist/*.egg ${dist_dir}
# rm -rf ${temp_dir}
echo "Build with all source dependencies complete."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment