package.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. #Steps when making a new release:
  2. #1. Update version number:
  3. # i. In AToMPM - client/constants.js
  4. # ii. In documentation - doc/conf.py
  5. # iii. In Node - package.json
  6. #2. Push these changes to GitHub
  7. #3. Create a new release on GitHub
  8. #4. The tag should be something like v0.8.0
  9. #5. Run this script, which will download the latest tagged version
  10. # and package everything
  11. # - Run it for the Python2 and the Python3 version
  12. # - Fix up the files in the package
  13. # - Delete the unused Python directory in each zip
  14. #6. Upload the package .zip to the release on GitHub
  15. #7. Publish to npm repo
  16. version="v0.8.2"
  17. package_python3=true
  18. #Python2
  19. portable_python_url="http://elvis.rowan.edu/mirrors/portablepython/v2.7/PortablePython_2.7.6.1.exe"
  20. igraph_whl_url="https://github.com/AToMPM/atompm/releases/download/v0.7.0/python_igraph-0.7.1.post6-cp27-cp27m-win32.whl"
  21. #Python3
  22. python_version="3.6.5"
  23. winpython_url="https://github.com/winpython/winpython/releases/download/1.10.20180404/WinPython32-3.6.5.0Zero.exe"
  24. igraph3_whl_url="https://github.com/AToMPM/atompm/releases/download/v0.7.0/python_igraph-0.7.1.post6-cp36-cp36m-win32.whl"
  25. #platform
  26. nodejs_zip_url="https://nodejs.org/dist/v8.11.3/node-v8.11.3-win-x64.zip"
  27. chrome_url="https://newcontinuum.dl.sourceforge.net/project/portableapps/Google%20Chrome%20Portable/GoogleChromePortable_67.0.3396.87_online.paf.exe"
  28. manual_url="https://media.readthedocs.org/pdf/atompm/latest/atompm.pdf"
  29. #$(curl --silent "https://api.github.com/repos/AToMPM/atompm/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
  30. echo "Packaging version: $version"
  31. #echo $nodejs_zip_url
  32. #echo $portable_python_url
  33. #echo $igraph_whl_url
  34. # STEPS
  35. # 1. Download Python
  36. # a. Currently, this is PortablePython from
  37. # b. http://portablepython.com/wiki/PortablePython2.7.6.1/
  38. function get_PP() {
  39. echo "Downloading PortablePython"
  40. PP_file=$(basename $portable_python_url)
  41. echo $PP_file
  42. if [ ! -f $PP_file ]; then
  43. echo "Downloading $portable_python_url"
  44. curl -O $portable_python_url
  45. fi
  46. # c. Install PortablePython
  47. #TODO: Automate installation
  48. #Z:\home\dcx\Projects\AToMPM\packaging\atompm-portable\platform\PortablePython27\
  49. #No modules and no core editors
  50. #Except for the Six package
  51. wine $PP_file
  52. # d. Install pip on the packaging machine (Python2 version)
  53. cd atompm-portable/platform/PortablePython27/App
  54. # INSTALL PIP
  55. #TODO: Fix this installation
  56. #wine scripts/easy_install.exe pip
  57. #TODO: Replace with above
  58. #pip2 install --upgrade --target=Lib/site-packages/ pip
  59. #INSTALL IGRAPH
  60. igraph_whl_file=$(basename $igraph_whl_url)
  61. echo $igraph_whl_file
  62. #if [ ! -f $igraph_whl_file ]; then
  63. # echo "Downloading $igraph_whl_url"
  64. # curl -O $igraph_whl_url
  65. #fi
  66. #MUST HAVE WHL FILE LOCALLY FOR NOW
  67. cd ../../../..
  68. unzip -o $igraph_whl_file -d atompm-portable/platform/PortablePython27/App/Lib/site-packages/
  69. }
  70. function get_WP() {
  71. echo "Downloading WinPython"
  72. WP_file=$(basename $winpython_url)
  73. echo $WP_file
  74. if [ ! -f $WP_file ]; then
  75. echo "Downloading $winpython_url"
  76. curl -O $winpython_url
  77. fi
  78. # c. Install WinPython
  79. #TODO: Automate installation
  80. #Z:\home\dcx\Projects\AToMPM\packaging\atompm-portable\platform\WinPython\
  81. #No modules and no core editors
  82. #Except for the Six package
  83. wine $WP_file
  84. # d. Install pip on the packaging machine (Python2 version)
  85. cd atompm-portable/platform/WinPython/python-$python_version
  86. # INSTALL IGRAPH
  87. #TODO: Fix this installation
  88. #wine Scripts/pip3 install python-igraph
  89. igraph3_whl_file=$(basename $igraph3_whl_url)
  90. echo $igraph3_whl_file
  91. #if [ ! -f $igraph_whl_file ]; then
  92. # echo "Downloading $igraph_whl_url"
  93. # curl -O $igraph_whl_url
  94. #fi
  95. #MUST HAVE WHL FILE LOCALLY FOR NOW
  96. cd ../../../..
  97. unzip -o $igraph3_whl_file -d atompm-portable/platform/WinPython/python-$python_version/Lib/site-packages/
  98. }
  99. function get_nodejs() {
  100. echo "Downloading NodeJS"
  101. # 2. Download node.js https://nodejs.org/en/download/
  102. # a. Choose Windows Binary (.zip)
  103. nodejs_file=$(basename $nodejs_zip_url)
  104. echo $nodejs_file
  105. if [ ! -f $nodejs_file ]; then
  106. echo "Downloading $nodejs_zip_url"
  107. curl -O $nodejs_zip_url
  108. fi
  109. unzip -o $nodejs_file -d atompm-portable/platform/
  110. mv atompm-portable/platform/node-v* atompm-portable/platform/NodeJS
  111. }
  112. # 3. Add ChromePortable
  113. function get_chrome() {
  114. echo "Downloading PortableChrome"
  115. chrome_file=$(basename $chrome_url)
  116. echo $chrome_file
  117. if [ ! -f $chrome_file ]; then
  118. echo "Downloading $chrome_url"
  119. curl -O $chrome_url
  120. fi
  121. #TODO: Automate installation
  122. #Z:\home\dcx\Projects\AToMPM\packaging\atompm-portable\platform\GoogleChromePortable
  123. wine GoogleChromePortable_67.0.3396.87_online.paf.exe
  124. }
  125. # 4. Add AToMPM files
  126. function add_atompm () {
  127. echo "Adding AToMPM"
  128. rm -rf atompm-portable/atompm
  129. cd atompm-portable
  130. git clone --depth 1 https://github.com/AToMPM/atompm.git
  131. cd atompm
  132. git checkout $version
  133. rm -rf .git
  134. npm install --production
  135. cd ../..
  136. }
  137. # 5. Add Windows batch scripts
  138. function add_batch_scripts (){
  139. echo "Adding batch scripts"
  140. cp windows_scripts/*.bat atompm-portable/
  141. }
  142. # 6. Add manual
  143. function add_manual(){
  144. echo "Adding manual"
  145. manual_filename="atompm-userguide.pdf"
  146. curl $manual_url -o $manual_filename
  147. cp $manual_filename atompm-portable/
  148. rm $manual_filename
  149. }
  150. ###MAIN######
  151. if [ "$package_python3" = false ] ; then
  152. if [ ! -d ./atompm-portable/platform/PortablePython27 ]; then
  153. get_PP
  154. fi
  155. else
  156. if [ ! -d ./atompm-portable/platform/WinPython ]; then
  157. get_WP
  158. fi
  159. fi
  160. if [ ! -d ./atompm-portable/platform/NodeJS ]; then
  161. get_nodejs
  162. fi
  163. if [ ! -d ./atompm-portable/platform/GoogleChromePortable ]; then
  164. get_chrome
  165. fi
  166. add_atompm
  167. add_batch_scripts
  168. add_manual
  169. rm atompm-portable.zip
  170. if [ "$package_python3" = false ] ; then
  171. zip -r atompm-portable-python2.zip atompm-portable/
  172. else
  173. zip -r atompm-portable-python3.zip atompm-portable/
  174. fi