if test -z "$DIST_FORMAT" ; then DIST_FORMAT="gztar" fi python setup.py sdist --dist-dir . --formats "$DIST_FORMAT" if test -n "$DIST_FILE" ; then dist_name=`python setup.py --name` dist_version=`python setup.py --version` case "$DIST_FORMAT" in gztar) dist_suffix=".tar.gz" ;; *) dist_suffix=".${DIST_FORMAT}" ;; esac produced_file="${dist_name}-${dist_version}${dist_suffix}" if test "$produced_file" != "$DIST_FILE" ; then mv "$produced_file" "$DIST_FILE" fi fi