package.sh 6.1 KB

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