Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Kivy_installer_plus.py -- tested on python27 windows10 *** work in progress
- import os
- import sys
- bit=str(sys.maxsize)
- print bit
- if bit == '2147483647':
- bit='-cp27-none-win32.whl'
- else:
- bit='-cp27-none-win_amd64.whl'
- print('Downloading '+bit+' Kivy as matched with System OS...')
- def run(targets, thru=0):
- if thru is 1: thru='install --upgrade '
- else: thru='uninstall'
- for target in targets:
- if target:
- if len(target) is 1:
- os.system('python -m pip '+thru+' '+targets)
- break
- if target[0].isalpha() or target[0] is '-':
- os.system('python -m pip '+thru+' '+target)
- # gstreamer is buggy, PySDL2 replaced pygame
- targets='''
- kivy
- cython
- image
- wheel
- pygame
- gstreamer
- PyOpenGL
- '''.split('\n')
- print targets
- # os.system('python -m pip uninstall ###')
- ans=raw_input("Uninstall dependencies as specified? (Y/N) : ").strip()
- if ans.lower() in ['y','yes']:
- print('Uninstalling specific dependencies...')
- run(targets)
- else:
- print('Skipped uninstall proceedures...')
- ans=raw_input("Might take a long while to VCForPython27.msi. Proceed anyway? (Y/N) : ").strip()
- if ans.lower() in ['y','yes']:
- print('Downloading VCForPython27.msi...')
- os.system('python -m pip install https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi')
- else:
- print('VCForPython27.msi skipped...')
- ans=raw_input("Might take a long while to android-ndk-r9d-linux-x86.tar.bz2. \nProceed anyway? (Y/N) : ").strip()
- if ans.lower() in ['y','yes']:
- print('Downloading android-ndk-r9d-linux-x86.tar.bz2...')
- os.system('python -m pip install http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2')
- else:
- print('android-ndk-r9d-linux-x86.tar.bz2 skipped...')
- # run('http://downloads.activestate.com/ActivePerl/releases/5.22.1.2201/ActivePerl-5.22.1.2201-MSWin32-x86-64int-299574.msi',1)
- ans=raw_input("Might take a long while to VCForPython27.msi. Proceed anyway? (Y/N) : ").strip()
- if ans.lower() in ['y','yes']:
- print('Downloading vcsetup.exe...')
- run('http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe',1)
- else:
- print('vcsetup.exe skipped...')
- ans=raw_input("Attempt to install beta dependencies? (Y/N) : ").strip()
- run('https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi',1)
- # run('http://download.microsoft.com/download/D/2/3/D23F4D0F-BA2D-4600-8725-6CCECEA05196/vs_community_ENU.exe',1)
- targets='''
- pip
- kivy
- wheel
- setuptools
- kivy.deps.sdl2
- PyOpenGL
- kivy.deps.glew
- virtualenv
- virtualenvwrapper-powershell
- -U watchdog jedi gitpython six kivy-garden
- buildozer
- cython
- docutils
- pygments
- pypiwin32
- image
- PySDL2
- pywin32
- numpy
- console
- Pillow
- PyAudio
- git
- build
- -i https://pypi.anaconda.org/carlkl/simple mingwpy
- '''.split('\n')
- print('Installing basic dependencies...')
- print targets
- run(targets,1)
- targets='''
- kivy-designer
- kivent
- --extra-index-url https://kivy.org/downloads/packages/simple/
- git://github.com/kivy/python-for-android.git
- git://github.com/kivy/kivy.git
- mingw32
- SDL2_gfx
- SDL2_image
- pywin
- PyQt
- qt
- p4a
- pyjnius
- pyobjus
- audiostream
- msvc
- setupegg
- pkg-name
- vcpython27
- vc_web
- py2exe
- gcc
- msys
- cygwin
- ffmpeg
- api
- winapi
- ubuntu
- dll
- scriptspywin32_postinstall
- '''.split('\n')
- if ans.lower() in ['y','yes']:
- print('Attempting to install beta dependencies...')
- print targets
- run(targets,1)
- else:
- print('Beta dependencies skipped...')
- code='''[build]
- compiler = mingw32'''
- folder = "C:/Python27/Lib/distutils/"
- try: os.mkdir(folder)
- except: pass
- filename = 'distutils.cfg'
- fullpath = folder + filename
- source = open(fullpath, 'w+')
- source.write(code)
- source.close()
- import shutil
- def copyfile(file):
- shutil.copy(src+file, dst+file)
- src=r'C:/Windows/System32/'
- dst=r'C:/Python27/DLLs/'
- dlls=[r'msvcp71.dll',r'msvcr71.dll']
- for dll in dlls:
- copyfile(dll)
- #
- os.popen('C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat')
- os.popen('C:\Perl\site\lib\XML\Parser\Expat\sample\build.bat')
- os.popen('C:\dev\Kivy\Kivy-1.8.0-py2.7-win32\Python27\Scripts\garden.bat')
- os.popen('C:\dev\MinGW\msys\1.0\msys.bat')
- os.popen('C:\dev\Kivy\Kivy-1.8.0-py2.7-win32\kivy\kivy\tools\packaging\win32\kivy-2.7\kivy.bat')
- os.popen('C:\dev\Kivy\Kivy-1.8.0-py2.7-win32.bat')
- text = raw_input("Run Cross Check Of Installments? (y/n): ").strip()
- if text.lower() in ['y','yes']:
- import random
- for i in range(30):
- print random.choice(range(5, 10))
- import kivy
- import PIL
- from kivy.app import App
- from kivy.uix.label import Label
- class TestApp(App):
- def build(self):
- return Label(text='Hello World')
- TestApp().run()
- print('\n-- End Of Session --')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement