1 #!/bin/sh 2 3 if [ $# == 1 ]; then 4 cd $1 5 fi 6 7 # Create a list of all the files in the source tree, excluding various things we 8 # know don't belong. 9 echo "Creating current directory contents list." 10 find . | \ 11 grep -v '^\./.gitignore' | \ 12 grep -v '^\./dist' | \ 13 grep -v '^\./utils' | \ 14 grep -v '^\./venv' | \ 15 grep -v '^\./lit.egg-info' | \ 16 grep -v '^\./lit/ExampleTests' | \ 17 grep -v '/Output' | \ 18 grep -v '__pycache__' | \ 19 grep -v '.pyc$' | grep -v '~$' | \ 20 sort > /tmp/lit_source_files.txt 21 22 # Create the source distribution. 23 echo "Creating source distribution." 24 rm -rf lit.egg-info dist 25 python setup.py sdist > /tmp/lit_sdist_log.txt 26 27 # Creating list of files in source distribution. 28 echo "Creating source distribution file list." 29 tar zft dist/lit*.tar.gz | \ 30 sed -e 's#lit-[0-9.dev]*/#./#' | \ 31 sed -e 's#/$##' | \ 32 grep -v '^\./PKG-INFO' | \ 33 grep -v '^\./setup.cfg' | \ 34 grep -v '^\./lit.egg-info' | \ 35 sort > /tmp/lit_sdist_files.txt 36 37 # Diff the files. 38 echo "Running diff..." 39 if (diff /tmp/lit_source_files.txt /tmp/lit_sdist_files.txt); then 40 echo "Diff is clean!" 41 else 42 echo "error: there were differences in the source lists!" 43 exit 1 44 fi 45