Enthought Python Distribution (EPD) update via command line

Since the enpkg command doesn’t currently provide a good automatic way to update all your installed packages via command line, here’s a great way to update all the packages already installed in your Enthought Python Distribution (EPD) installation:

$epd_update

Run this command, after you have added this function code to your ~/.bash_profile, or in ~/.bashrc file:

function epd_update ()
{
    echo "[ Checking for epd package updates... ]"
    #-- display new packages
    sudo enpkg --whats-new
    #-- save new package list
    sudo enpkg --whats-new > /tmp/enpkgnew.txt
    #-- save only the first word after the "=====", it will be "no" if there are no new packages to be updated
    firstword=$(sed '1,2d' /tmp/enpkgnew.txt | awk 'NR>1{exit};1' | awk '{print $1}')
    if [ "$firstword" == "no" ]; then
        echo "[ No package updates available, exiting ]"
    else
        echo "[ Updating... ]"
        #-- space delimited list of the new packages
        newpacks=$(sed '1,2d' /tmp/enpkgnew.txt | awk '{print $1}' | tr "\n" " ")
        #-- update the new packages
        sudo enpkg $newpacks
    fi
}

It will either exit if there are no new packages, or will systematically install all new ones. Enjoy!

1 thought on “Enthought Python Distribution (EPD) update via command line

Leave a Reply

Your email address will not be published. Required fields are marked *