File: pymailgui-products/unzipped/_publish.sh
#================================================================================ # Build+publish the full PyMailGUI source-code package [4.1]. Run anywhere as: # # bash _publish.sh # # This publishes just the source-code package. App and executable packages # have their own build/ scripts which must be run on specific platforms; are # each built as an atomic zip which can be uploaded in a single step; and are # rarely updated due to flux in build tools, platforms, and Python itself. # The source-code package is also unzipped for online access at hosting site. # # Notes: # - This works only on PyMailGUI's host; paths and structure are host specific. # - docetc/docimgs/ also has a _publish.sh to upload just its image galleries. # - This used to all be done manually; automation makes changes much easier. #================================================================================ # Get common defs - host specific source ~/MY-STUFF/Websites/_admin/BUILD-THUMBSPAGE-CLIENTS/common.sh Pause=y function announce() { echo echo $1 if [ $Pause == 'y' ]; then read -p 'Press enter/return to continue' fi } #------------------------------------------------------------------------------ # 1) Update three image galleries in $C first, iff not already current. # They usually are up to date, because thumbspage changes more often. #------------------------------------------------------------------------------ read -p "Make galleries now in $C (y or n)? " userreply if [[ -n $userreply && $userreply == 'y' ]] then cd $C/pymailgui/docetc/docimgs platforms='macosx windows linux' for platform in $platforms; do py3 $C/thumbspage/thumbspage.py $platform <<-EOF EOF done fi #------------------------------------------------------------------------------ # 2) Make source-package zip in Code/, copy to Websites/, and unzip. # The build.py script does some housecleaning, and runs a zip-create.py. #------------------------------------------------------------------------------ announce 'Making source-package zip' pubdir=$W/Programs/Current/Complete/pymailgui-products cd $C/pymailgui/build/build-source py3 build.py cp -p PyMailGUI-source.zip $pubdir cp -p PyMailGUI-source.zip ../../_private_/PyMailGUI-source--$stamp.zip cd $pubdir rm -rf unzipped py3 $Z/zip-extract.py PyMailGUI-source.zip . -permissions mv PyMailGUI-source unzipped #------------------------------------------------------------------------------ # 3) Add analytics code, and assume image galleries are current. # Else, run thumbspage first (step 1); analytics are anonymized ahead. #------------------------------------------------------------------------------ announce 'Adding analytics' cd unzipped # main/newest guide py3 $M/insert-analytics.py UserGuide.html # screenshot galleries py3 $M/insert-analytics.py docetc/docimgs/index.html py3 $M/insert-analytics.py docetc/docimgs/macosx/index.html py3 $M/insert-analytics.py docetc/docimgs/windows/index.html py3 $M/insert-analytics.py docetc/docimgs/linux/index.html #------------------------------------------------------------------------------ # 4) Copy the .zip and unzipped/ folder to union, zip as a combo for upload. # The _PUBLISH.py step adds IP-anonymize code in analytics, and fixes readmes. #------------------------------------------------------------------------------ announce 'Building site and upload zip' cd $W py3 _PUBLISH.py | tail -n 20 cd UNION/pymailgui-products py3 $Z/zip-create.py pmgcombo.zip unzipped PyMailGUI-source.zip -skipcruft #------------------------------------------------------------------------------ # 5) Upload combo zip to site and unzip there: remakes .zip+unzipped/. #------------------------------------------------------------------------------ announce 'Uploading and unzipping on server' SCP pmgcombo.zip htdocs/pymailgui-products SSH <<-EOF cd htdocs/pymailgui-products rm -rf unzipped PyMailGUI-source.zip unzip -d . pmgcombo.zip rm pmgcombo.zip exit EOF rm pmgcombo.zip # local UNION copy #-------------------------------------------- # 6) Download and verify zip: live to local #-------------------------------------------- cd $temp rm -rf UserGuide.html PyMailGUI-source.zip PyMailGUI-source diffallpmg mergeallpmg # content printf '\n** Diff: there should be 1 diff in UserGuide for analytics\n' curl -O https://learning-python.com/pymailgui-products/unzipped/UserGuide.html diff UserGuide.html $C/pymailgui/UserGuide.html # zipfile printf '\n** Cmp: there should be no cmp output for zip\n' curl -O https://learning-python.com/pymailgui-products/PyMailGUI-source.zip cmp -bl PyMailGUI-source.zip $C/pymailgui/_private_/PyMailGUI-source--$stamp.zip # unzippped content py3 $Z/zip-extract.py PyMailGUI-source.zip . > /dev/null # makes PyMailGUI-source/ printf '\n** Diffall: there should be 10 (2 diff, 8 uniq) for -top/pyedit, 4 pkgs~strips\n' py3 $C/mergeall/diffall.py PyMailGUI-source $C/pymailgui -skipcruft > diffallpmg tail -n 13 diffallpmg printf '\n** Diffall: search for *UNIQ to see diffs\n' grep --context=8 '*UNIQ' diffallpmg printf '\n** Mergeall: there should be "samefile: 2, uniqueto: 9, uniquefrom: 18"\n' py3 $C/mergeall/mergeall.py $C/pymailgui PyMailGUI-source -skipcruft -report > mergeallpmg tail -n 10 mergeallpmg printf '\n** Mergeall: these should mirror the diffall diffs\n' tail -n 78 mergeallpmg # keep to eyeball: rm -rf UserGuide.html PyMailGUI-source.zip PyMailGUI-source diffallpmg mergeallpmg echo 'Bye.'