Advertisement
here2share

# Kivy_installer_plus.py

Jan 24th, 2016
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.67 KB | None | 0 0
  1. # Kivy_installer_plus.py -- tested on python27 windows10 *** work in progress
  2.  
  3. import os
  4. import sys
  5.  
  6. bit=str(sys.maxsize)
  7. print bit
  8. if bit == '2147483647':
  9.     bit='-cp27-none-win32.whl'
  10. else:
  11.     bit='-cp27-none-win_amd64.whl'
  12. print('Downloading '+bit+' Kivy as matched with System OS...')
  13.  
  14. def run(targets, thru=0):
  15.     if thru is 1: thru='install --upgrade '
  16.     else: thru='uninstall'
  17.     for target in targets:
  18.         if target:
  19.             if len(target) is 1:
  20.                 os.system('python -m pip '+thru+' '+targets)
  21.                 break
  22.             if target[0].isalpha() or target[0] is '-':
  23.                 os.system('python -m pip '+thru+' '+target)
  24.  
  25. # gstreamer is buggy, PySDL2 replaced pygame
  26. targets='''
  27. kivy
  28. cython
  29. image
  30. wheel
  31. pygame
  32. gstreamer
  33. PyOpenGL
  34. '''.split('\n')
  35. print targets
  36.  
  37. # os.system('python -m pip uninstall ###')
  38.  
  39. ans=raw_input("Uninstall dependencies as specified? (Y/N) : ").strip()
  40. if ans.lower() in ['y','yes']:
  41.     print('Uninstalling specific dependencies...')
  42.     run(targets)
  43. else:
  44.     print('Skipped uninstall proceedures...')
  45.  
  46. ans=raw_input("Might take a long while to VCForPython27.msi. Proceed anyway? (Y/N) : ").strip()
  47. if ans.lower() in ['y','yes']:
  48.     print('Downloading VCForPython27.msi...')
  49.     os.system('python -m pip install https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi')
  50. else:
  51.     print('VCForPython27.msi skipped...')
  52.  
  53. ans=raw_input("Might take a long while to android-ndk-r9d-linux-x86.tar.bz2. \nProceed anyway? (Y/N) : ").strip()
  54. if ans.lower() in ['y','yes']:
  55.     print('Downloading android-ndk-r9d-linux-x86.tar.bz2...')
  56.     os.system('python -m pip install http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2')
  57. else:
  58.     print('android-ndk-r9d-linux-x86.tar.bz2 skipped...')
  59. # run('http://downloads.activestate.com/ActivePerl/releases/5.22.1.2201/ActivePerl-5.22.1.2201-MSWin32-x86-64int-299574.msi',1)
  60.  
  61. ans=raw_input("Might take a long while to VCForPython27.msi. Proceed anyway? (Y/N) : ").strip()
  62. if ans.lower() in ['y','yes']:
  63.     print('Downloading vcsetup.exe...')
  64.     run('http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe',1)
  65. else:
  66.     print('vcsetup.exe skipped...')
  67.  
  68. ans=raw_input("Attempt to install beta dependencies? (Y/N) : ").strip()
  69.  
  70. run('https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi',1)
  71.  
  72. # run('http://download.microsoft.com/download/D/2/3/D23F4D0F-BA2D-4600-8725-6CCECEA05196/vs_community_ENU.exe',1)
  73.  
  74.  
  75. targets='''
  76. pip
  77. kivy
  78. wheel
  79. setuptools
  80. kivy.deps.sdl2
  81. PyOpenGL
  82. kivy.deps.glew
  83. virtualenv
  84. virtualenvwrapper-powershell
  85. -U watchdog jedi gitpython six kivy-garden
  86. buildozer
  87. cython
  88. docutils
  89. pygments
  90. pypiwin32
  91. image
  92. PySDL2
  93. pywin32
  94. numpy
  95. console
  96. Pillow
  97. PyAudio
  98. git
  99. build
  100. -i https://pypi.anaconda.org/carlkl/simple mingwpy
  101. '''.split('\n')
  102.  
  103. print('Installing basic dependencies...')
  104. print targets
  105. run(targets,1)
  106.  
  107. targets='''
  108. kivy-designer
  109. kivent
  110. --extra-index-url https://kivy.org/downloads/packages/simple/
  111. git://github.com/kivy/python-for-android.git
  112. git://github.com/kivy/kivy.git
  113. mingw32
  114. SDL2_gfx
  115. SDL2_image
  116. pywin
  117. PyQt
  118. qt
  119. p4a
  120. pyjnius
  121. pyobjus
  122. audiostream
  123. msvc
  124. setupegg
  125. pkg-name
  126. vcpython27
  127. vc_web
  128. py2exe
  129. gcc
  130. msys
  131. cygwin
  132. ffmpeg
  133. api
  134. winapi
  135. ubuntu
  136. dll
  137. scriptspywin32_postinstall
  138. '''.split('\n')
  139.  
  140. if ans.lower() in ['y','yes']:
  141.     print('Attempting to install beta dependencies...')
  142.     print targets
  143.     run(targets,1)
  144. else:
  145.     print('Beta dependencies skipped...')
  146.  
  147. code='''[build]
  148. compiler = mingw32'''
  149. folder = "C:/Python27/Lib/distutils/"
  150. try: os.mkdir(folder)
  151. except: pass
  152. filename = 'distutils.cfg'
  153. fullpath = folder + filename
  154. source = open(fullpath, 'w+')
  155. source.write(code)
  156. source.close()
  157.  
  158. import shutil
  159. def copyfile(file):
  160.     shutil.copy(src+file, dst+file)
  161. src=r'C:/Windows/System32/'
  162. dst=r'C:/Python27/DLLs/'
  163.  
  164. dlls=[r'msvcp71.dll',r'msvcr71.dll']
  165. for dll in dlls:
  166.     copyfile(dll)
  167. #
  168.  
  169. os.popen('C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat')
  170. os.popen('C:\Perl\site\lib\XML\Parser\Expat\sample\build.bat')
  171. os.popen('C:\dev\Kivy\Kivy-1.8.0-py2.7-win32\Python27\Scripts\garden.bat')
  172. os.popen('C:\dev\MinGW\msys\1.0\msys.bat')
  173. os.popen('C:\dev\Kivy\Kivy-1.8.0-py2.7-win32\kivy\kivy\tools\packaging\win32\kivy-2.7\kivy.bat')
  174. os.popen('C:\dev\Kivy\Kivy-1.8.0-py2.7-win32.bat')
  175.  
  176. text = raw_input("Run Cross Check Of Installments? (y/n): ").strip()
  177. if text.lower() in ['y','yes']:
  178.     import random
  179.     for i in range(30):
  180.         print random.choice(range(5, 10))
  181.  
  182.     import kivy
  183.     import PIL
  184.  
  185.     from kivy.app import App
  186.     from kivy.uix.label import Label
  187.  
  188.     class TestApp(App):
  189.         def build(self):
  190.             return Label(text='Hello World')
  191.      
  192.     TestApp().run()
  193.  
  194. print('\n-- End Of Session --')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement