home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Install_Python < prev    next >
Encoding:
Text File  |  2000-10-28  |  15.0 KB  |  413 lines

  1. ;------------------------------------------------------------------------
  2. ;
  3. ; Python Installation script for Python version 2.0
  4. ;
  5. ; Copyright © Irmen de Jong.
  6. ; V2.7 (28-oct-2000)
  7. ;
  8.  
  9. (set OSVersion          (/ (getversion) 65536))
  10.  
  11. (set cpu (database "cpu"))
  12.  
  13. (set @app-name "Python 2.0")
  14.  
  15. (set #source-dir (pathonly @icon) )
  16.  
  17. ;
  18. ; ENGLISH STRINGS
  19. ;
  20. (set #welcomemsg "Installation of Python 2.0\n\nA new directory (with icon) will be created, in which the program is installed.\n\n(note: it is advised to leave a previous Python: assign active with this installation)")
  21. (set #osmsg "ARGH! You have an obsolete Kickstart version!\n\nPython only works on Kickstart 2.04 or higher. Upgrade to 3.1!")
  22. (set #nopretendmsg "Can only install for real.")
  23. (set #updatemsg "This will install a fresh copy of Python 2.0.\nIf you already have installed the previous version, you might consider running the Update_Previous script instead.\nIf so, abort this installation now.")
  24. (set #oldversionmsg "\nDo you have a previous installed version, and if so, do you want to delete that (fully)?\nWARNING: If you select 'yes', the full contents of the directory of the old version will be deleted!\n\n\n(If you have a previous version installed, and you don't delete it, you must install this new version to a new directory)")
  25. (set #oldversionhelp "Yes: delete all files from old version. You can then install this new version in the place of the old one, otherwise, you'll have to install this version in a new directory.\n\nIf you have any files in the directory of the old version that you want to keep, SELECT 'NO'!")
  26. (set #whereisold "Where is your previous release installed?")
  27. (set #deleteoldmsg "\nWill now delete old version. Last chance to keep old data!")
  28. (set #willdeletemsg "\nWill now delete drawer\n\n%s\n\ncompletely.")
  29. (set #willdeletehelp "Last chance to keep old files: click 'Abort'!")
  30. (set #deleteworkmsg "Deleting %s...")
  31. (set #oldversion "old version")
  32. (set #deleteinstall "Do you want to delete the installation directory?\n\n(it is no longer needed)")
  33. (set #installationfiles "installation files")
  34. (set #whereprompt "Were must Python be installed? Most of the files don't have to be copied, if you accept the offered default.")
  35. (set #wherehelp "  Here you can specify the location where to install Python.\n  Installation can be made on-place. This is recommended if you have already unarchived the Python archive to its final location. In this case most of the files are left where they are. Only necessary files are moved to different positions.\n  If you choose another location, a new subdirectory will be created (with icon) in which the program is installed.")
  36. (set #currentmsg "\nInstalling Python to\n\n%s\n\n(the current place)")
  37. (set #existingerr "Can't install into existing directory!")
  38. (set #oldstillexistserr "Couldn't fully remove old drawer! (is it still in use?)")
  39. (set #newmsg "\nInstalling Python to\n\n%s\n\n(a new directory)" )
  40. (set #whichprompt "Which version of the program should be installed?")
  41. (set #whichhelp "Choose the version which matches your CPU/FPU configuration best.\nRead the README file for info on how to obtain other versions.\n\n")
  42. (set #startupprompt "The following commands will be added to your \"S:User-Startup\" file (You'll need them to run Python):\n\nASSIGN Python: %s\nPATH Python: ADD\n")
  43. (set #readmemsg (cat "Please read shown information...\n\n\n(It is also wise to read the README file)"))
  44. (set #abort "Abort")
  45. (set #proceed "Proceed")
  46. (set #endmsg "\nPython 2.0 is now installed!\n\nIf you're using NewIcons, take a look in the Icons directory. NewIcon versions of the icons are available there.")
  47. (set #nexttoprev "You seem to have a previous version of Python already installed. If that is version 1.6 or earlier, you can install this new version 2.0 NEXT TO the old one. Do you want to do that?")
  48. (set #nexttoprev_help "If you install this version NEXT TO your previous version, you can use both at the same time.")
  49. (set #nexttoprev_yes "Yes, next to previous")
  50. (set #nexttoprev_no "No, standalone")
  51. (set #installnextto_done "The new version ('Python20') has been installed next to the previous one, which remains available as 'Python'. Additional new files can be found in the 'Python:Python-2.0' subdirectory.")
  52. ;
  53. ; NEDERLANDSE STRINGS
  54. ;
  55. (if (= @language "nederlands")
  56. (
  57. (set #welcomemsg "Installatie van Python 2.0\n\nEr wordt een nieuwe lade (met ikoon) aangemaakt, waarin het programma wordt geïnstalleerd.\n\n(opmerking: het is aan te raden een vorige Python: assign te laten bestaan voor deze installatie)")
  58. (set #osmsg "ARGH! U heeft een verouderde Kickstart versie!\n\nPython werkt alleen op Kickstart 2.04 of nieuwer. Upgrade naar 3.1!")
  59. (set #nopretendmsg "Kan alleen echte installatie uitvoeren.")
  60. (set #updatemsg "Er zal een nieuwe installatie van Python 2.0 plaatsvinden.\nAls u al een vorige versie heeft geïnstalleerd, is het aan te raden om het Update_Previous script te gebruiken inplaats van dit installatieprogramma.\nAls u dat wilt, moet u nu deze installatie afbreken.")
  61. (set #oldversionmsg "\nHeeft u een vorige versie geïnstalleerd, en zo ja, wilt u deze dan (in zijn geheel) verwijderen?\nWAARSCHUWING: als u 'ja' kiest, wordt de complete inhoud van de lade van de oude versie gewist!\n\n\n(Als u een vorige versie geïnstalleerd heeft, en deze niet verwijdert, moet u de nieuwe versie in een nieuwe lade installeren)")
  62. (set #oldversionhelp "Ja: verwijder alle files van de oude versie. U kunt dan deze nieuwe versie op de plaats van de oude installeren, anders moet u dat in een nieuwe lade doen.\n\nAls u files heeft in de lade van de oude versie die u wilt bewaren, KIES DAN 'NEE'!")
  63. (set #whereisold "Waar is uw vorige versie geïnstalleerd?")
  64. (set #deleteoldmsg "\nOude versie wordt nu verwijderd. Laatste kans om oude files te bewaren!")
  65. (set #willdeletemsg "\nDe lade\n\n%s\n\nwordt in zijn geheel verwijderd.")
  66. (set #willdeletehelp "Laatste kans om oude files te bewaren: klik 'Stop'!")
  67. (set #deleteworkmsg "%s wordt verwijderd...")
  68. (set #oldversion "Oude versie")
  69. (set #deleteinstall "Wilt u de installatie-lade verwijderen?\n\n(die is niet langer nodig)")
  70. (set #installationfiles "Installatie files")
  71. (set #whereprompt "Waar moet Python geïnstalleerd worden? De meeste files hoeven niet gekopiëerd te worden, als u de standaard keuze accepteert.")
  72. (set #wherehelp "  Hier kunt u de lokatie van Python opgeven.\n  De installatie kan ter plekke plaatsvinden. Dit is aanbevolen als u de Python archive al in de juiste plaats heeft uitgepakt. In dit geval worden de meeste files met rust gelaten. Slechts een paar files worden naar hun benodigde lokatie gekopiëerd.\n  Als u een andere lokatie kiest, wordt een nieuwe lade (met ikoon) aangemaakt, waarin Python wordt geïnstalleerd.")
  73. (set #currentmsg "\nInstalleren van Python in\n\n%s\n\n(de huidige plaats)")
  74. (set #existingerr "Kan niet in bestaande lade installeren!")
  75. (set #oldstillexistserr "Kan oude lade niet volledig verwijderen! (wordt hij nog gebruikt?)")
  76. (set #newmsg "\nPython wordt geïnstalleerd in\n\n%s\n\n(een nieuwe lade)" )
  77. (set #whichprompt "Welke versie van het programma moet geïnstalleerd worden?")
  78. (set #whichhelp "Kies de versie die het beste bij uw CPU/FPU configuratie past.\nLees het README bestand voor informatie over hoe andere versies te verkrijgen.\n\n")
  79. (set #startupprompt "De volgende commando's zullen aan uw \"S:User-Startup\" bestand worden toegevoegd (ze zijn nodig om Python te kunnen gebruiken):\n\nASSIGN Python: %s\nPATH Python: ADD\n")
  80. (set #readmemsg (cat "Leest u AUB de getoonde informatie...\n\n\n(Het is ook verstandig om de README file te lezen)"))
  81. (set #abort "Stop")
  82. (set #proceed "Ga verder")
  83. (set #endmsg "\nPython 2.0 is nu geïnstalleerd!\n\nAls u NewIcons gebruikt, kijk dan eens in de Icons directory. Hier zijn NewIcon versies van de icons beschikbaar.")
  84. (set #nexttoprev "U heeft waarschijnlijk al een vorige versie van Python geïstalleerd. Als dat versie 1.6 of eerder is, kunt u deze versie 2.0 ERBIJ zetten. Wilt u dat?")
  85. (set #nexttoprev_help "Als u deze nieuwe versie BIJ de oude installeert, kunt u de nieuwe en de oude tegelijkertijd blijven gebruiken.")
  86. (set #nexttoprev_yes "Ja, ERBIJ zetten")
  87. (set #nexttoprev_no "Nee, los installeren")
  88. (set #installnextto_done "De nieuwe versie ('Python20') is geïnstalleerd naast de vorige versie, die nog steeds ongewijzigd aan te roepen is d.m.v. 'Python'. Overige nieuwe bestanden zijn te vinden in de 'Python:Python-2.0' subdirectory.")
  89. )
  90. )
  91.  
  92. ;------------------------------------------------------------------------
  93. ;;;;
  94. ;;;; Subroutines follow below:
  95. ;;;;
  96.  
  97. ;;;;
  98. ;;;; Check if OS version is good enough.
  99. ;;;;
  100. (procedure checkKick
  101.  (if (< OSVersion 37)
  102.     (message #osmsg)
  103.  )
  104. )
  105.  
  106. ;;;;
  107. ;;;; Find out which pager to use ($PAGER or sys:utilities/multiview)
  108. ;;;;
  109. (procedure installPager
  110.  (set pager-cmd
  111.    (if (exists "ENV:PAGER" (noreq)) (getenv "PAGER") ("SYS:Utilities/Multiview")
  112.    )
  113.  )
  114. )
  115.  
  116. ;;;;
  117. ;;;; Ask user if she wants to delete an old version.
  118. ;;;;
  119. (procedure removeOldversion
  120. (if (askbool 
  121.     (prompt #oldversionmsg)
  122.     (help #oldversionhelp)
  123.     )
  124.     (
  125.         (set oldreleasepath "Python:")
  126.         (set oldreleasepath (expandpath
  127.             (askdir
  128.                 (prompt #whereisold)
  129.                 (help "Select directory")
  130.                 (default "Python:")
  131.             ) )
  132.         )    
  133.  
  134.         (if (askbool
  135.             (prompt (#willdeletemsg oldreleasepath))
  136.             (help #willdeletehelp)
  137.             (choices #proceed #abort)
  138.             )
  139.             (
  140.                 (working (#deleteworkmsg #oldversion))
  141.                 (run "assign Python: remove")
  142.                 (run ("delete >NIL: %s %s.info FORCE ALL" oldreleasepath oldreleasepath))
  143.                 ;;; Check if indeed all stuff went to the bitbasket
  144.                     (if (exists oldreleasepath) (abort #oldstillexistserr))
  145.             )
  146.             (abort)
  147.         )
  148.     )
  149. )
  150. )
  151.  
  152. ;;;;
  153. ;;;; Select wether to install next to existing Python.
  154. ;;;;
  155. (procedure installNextToPrev
  156. (if (exists "Python:" (noreq))
  157.  (
  158.     (askbool (prompt #nexttoprev )
  159.     (help #nexttoprev_help )
  160.     (choices #nexttoprev_yes #nexttoprev_no ) )
  161.  )
  162.  FALSE
  163. )
  164. )
  165.  
  166. ;;;;
  167. ;;;; Select destination. Create drawer if necessary.
  168. ;;;;
  169. (procedure selectDestination
  170. (set destination
  171.     (askdir
  172.         (prompt #whereprompt)
  173.         (help #wherehelp)
  174.         (newpath)
  175.         (default #source-dir)
  176.     )
  177. )    
  178.  
  179. (set @default-dest destination)
  180.  
  181. (if (= #source-dir destination)
  182.     (
  183.         (set #otherdir FALSE)
  184.         (message (#currentmsg destination))
  185.     )
  186.     (
  187.         (set #otherdir TRUE)
  188.         (set tempdest destination)
  189.         (set destination (tackon destination "Python-2.0"))
  190.  
  191.         (if (exists destination) (abort #existingerr))
  192.  
  193.         (message (#newmsg destination))
  194.         (makedir destination)
  195.         (copyfiles
  196.         (source (tackon #source-dir "Icons/Drawer.info"))
  197.         (dest tempdest)
  198.         (newname "Python-2.0.info")
  199.         )
  200.     )
  201. )
  202. )
  203.  
  204.  
  205. ;;;;
  206. ;;;; Install the Python binary.
  207. ;;;;
  208. (procedure installprog
  209.  (if #otherdir
  210.    (
  211.     (copyfiles
  212.     (source (tackon #source-dir "Python_030"))
  213.     (dest destination)
  214.     (newname "Python")
  215.     )
  216.     (run ("delete >NIL: FORCE %s/python_#?" destination))
  217.    )
  218.    (
  219.     (rename (tackon #source-dir "Python_030") (tackon #source-dir "Python") )
  220.    )
  221.  )
  222. )
  223.  
  224.  
  225. ;;;;
  226. ;;;; Ask user if she wants to delete the installation drawer.
  227. ;;;;
  228. ;;;; BUG: hmm this doesnt work because installer keeps a lock in that drawer.
  229. ;;;;
  230. ;(procedure removeInstallation
  231. ;(if (askbool (prompt #deleteinstall) (help ""))
  232. ;    (
  233. ;    (working (#deleteworkmsg #installationfiles))
  234. ;    (message ("delete >NIL: %s %s.info FORCE ALL" #source-dir #source-dir))
  235. ;    (run ("delete >NIL: %s %s.info FORCE ALL" #source-dir #source-dir))
  236. ;    )
  237. ;)
  238. ;)
  239.  
  240.  
  241. ;------------------------------------------------------------------------
  242. ;;;;
  243. ;;;; Now, install the files.
  244. ;;;;
  245. (procedure installFiles
  246. (if #otherdir
  247.   (
  248.     (installprog)
  249.     (complete 50)
  250.     (copyfiles
  251.     (source #source-dir)
  252.     (dest destination)
  253.     (pattern "(Lib|Demo|Docs|Icons|Modules)")
  254.     (infos)
  255.     )
  256.     (complete 90)
  257.     (copyfiles
  258.     (source (tackon #source-dir "DISCL_and_COPYRIGHT"))
  259.     (dest destination) (infos))
  260.     (copyfiles
  261.     (source (tackon #source-dir "README"))
  262.     (dest destination) (infos))
  263.     (copyfiles
  264.     (source (tackon #source-dir "CHANGES"))
  265.     (dest destination) (infos))
  266.     (copyfiles
  267.     (source (tackon #source-dir "RunTest.py"))
  268.     (dest destination) (infos))
  269.     (copyfiles
  270.     (source (tackon #source-dir "Icons/def_py.info"))
  271.     (dest destination)
  272.     (newname "RunTest.py.info")
  273.     )
  274.  
  275.     (copyfiles
  276.     (source (tackon #source-dir "Icons/Python.info"))
  277.     (dest destination)
  278.     (newname "Python.info")
  279.     )
  280.  
  281.     ;;;; Because we installed to another drawer, the installation files can be removed.
  282.     ;(removeInstallation)    ; Doesn't work: installer still locks drawer
  283.  
  284.   )
  285.   (
  286.     (complete 50)
  287.     (installprog)
  288.     (complete 75)
  289.     (copyfiles
  290.     (source (tackon #source-dir "Icons/Python.info"))
  291.     (dest destination)
  292.     (newname "Python.info")
  293.     )
  294.     (copyfiles
  295.     (source (tackon #source-dir "Icons/def_py.info"))
  296.     (dest destination)
  297.     (newname "RunTest.py.info")
  298.     )
  299.     (run ("delete >NIL: FORCE %s/(python_#?|install#?)" destination))
  300.     (run ("delete >NIL: FORCE %s/Update_Previous#?" destination))
  301.   )
  302. )
  303. )
  304.  
  305. ;------------------------------------------------------------------------
  306. ;;;;
  307. ;;;; Install the files next to previous version.
  308. ;;;;
  309. (procedure installFilesNextToPrev
  310. (
  311.     (set #otherdir TRUE)
  312.     (set tempdest "Python:" )
  313.     (set destination (tackon tempdest "Python-2.0"))
  314.     (set @default-dest tempdest)
  315.  
  316.     ;; create destination subdirectory
  317.         (makedir destination)
  318.         (copyfiles
  319.         (source (tackon #source-dir "Icons/Drawer.info"))
  320.         (dest tempdest)
  321.         (newname "Python-2.0.info")
  322.         )
  323.  
  324.     ;; install files
  325.     (installFiles)
  326.  
  327.     ;; rename new Python binary to Python20 in parent dir (next to previous one)
  328.     (rename (tackon destination "Python") (tackon tempdest "Python20") )
  329.     (rename (tackon destination "Python.info") (tackon tempdest "Python20.info") )
  330.  
  331.     ;; move library files to Python:lib
  332.     (rename (tackon destination "Lib/Python2.0") (tackon tempdest "Lib/Python2.0") )
  333.  
  334.     ;; copy site-python files
  335.         (copyfiles
  336.         (source (tackon destination "Lib/site-python"))
  337.         (dest (tackon tempdest "Lib/site-python"))
  338.     (pattern "#?.py")
  339.         )
  340.     
  341.     ;; delete original Lib dir
  342.     (run ("delete >NIL: FORCE ALL %s" (tackon destination "Lib")))
  343.  
  344.     (message #installnextto_done)
  345. )
  346. )
  347.  
  348. ;------------------------------------------------------------------------
  349. ;;;;
  350. ;;;; Main installation sequence starts here
  351. ;;;;
  352.  
  353. (if (= @pretend 1)
  354.     (abort #nopretendmsg)
  355. )
  356.  
  357. ;;;; DISABLED FOR 2.0 installation:
  358. ;;;; (message #updatemsg)
  359.  
  360. (message #welcomemsg)
  361.  
  362. (checkKick)
  363.  
  364. (installPager)
  365.  
  366. (complete 0)
  367.  
  368. (if (installNextToPrev)
  369.  (
  370.     ;; INSTALL NEXT TO PREVIOUS VERSION
  371.  
  372.     (installFilesNextToPrev)
  373.  
  374.     (complete 95)
  375.  )
  376.  (
  377.     ;; Install standalone
  378.  
  379.     (removeOldversion)
  380.  
  381.     (complete 10)
  382.  
  383.     (selectDestination)
  384.  
  385.     (complete 25)
  386.  
  387.     (installFiles)
  388.  
  389.     (complete 95)
  390.  
  391.     (startup @app-name
  392.             (prompt (#startupprompt destination))
  393.             (help @startup-help)
  394.             (command ("ASSIGN Python: %s\n" destination))
  395.             (command "PATH Python: ADD\n")
  396.     )
  397.  
  398.     (run ("ASSIGN >NIL: Python: %s" destination))
  399.  
  400.  )
  401. )
  402.  
  403.  
  404. (run (cat "run " pager-cmd " %s") (tackon destination "DISCL_and_COPYRIGHT") (safe))
  405.  
  406. (message #readmemsg)
  407. (message #endmsg)
  408.  
  409. (run "delete >NIL: ram:more FORCE")
  410.  
  411. (complete 100) ; 100% done!
  412.  
  413.