From 77edbda6301997b9e88240a4fc7573e75d62cb57 Mon Sep 17 00:00:00 2001
From: Peter Badida <KeyWeeUsr@users.noreply.github.com>
Date: Sat, 26 Nov 2016 16:10:44 +0100
Subject: [PATCH] Add py35 structure

---
 appveyor.yml | 73 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 70 insertions(+), 3 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 0e4188d74..49f9b6c6e 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,7 +1,7 @@
 version: 1.0.{build}
 branches:
   only:
-  - master
+  - appveyor
   - gl-happy
 image: Unstable
 environment:
@@ -19,6 +19,9 @@ environment:
   USE_GSTREAMER: 1
   KIVY_USE_SETUPTOOLS: 1
   matrix:
+  - PYVER: 35
+    BITTNESS: 86
+    COMPILER: msvc
   - PYVER: 27
     BITTNESS: 86
   - PYVER: 34
@@ -27,6 +30,9 @@ environment:
     BITTNESS: 64
   - PYVER: 34
     BITTNESS: 64
+  - PYVER: 35
+    BITTNESS: 64
+    COMPILER: msvc
 install:
 - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1'))
 build_script:
@@ -126,7 +132,7 @@ build_script:
     echo "test=$env:DO_TEST, make_wheel=$DO_WHEEL"
 
 
-    if ($env:DO_TEST -eq "True" -or $DO_WHEEL -eq "True") {
+    if (($env:DO_TEST -eq "True" -or $DO_WHEEL -eq "True") -and $env:PYVER -ne "35") {
       python -c "with open(r'$PYTHON_ROOT\Lib\distutils\distutils.cfg', 'wb') as fh: fh.write(b'[build]\ncompiler = mingw32\n')"
       Check-Error
       python -m pip install pip wheel setuptools --upgrade
@@ -142,9 +148,70 @@ build_script:
 
       python setup.py build_ext --inplace
       Check-Error
-    }
+    } else {
+      $py35="C:\py35"
+      if ($env:BITTNESS -eq "64") {
+        $sdl2_url = "0B-080DPVLKs2cWZXRXhGSXZqYmM"
+        $sdl2_dev_url = "0B-080DPVLKs2QVZ6QUlTQjlwamM"
+        $glew_url = "0B-080DPVLKs2UkdqTUZWZmdvRXc"
+        $glew_dev_url = "0B-080DPVLKs2Q09zVnVjYngtX0E"
+        $sdl2_file = $py35+"\kivy.deps.sdl2-0.1.13-cp35-cp35m-win_amd64.whl"
+        $sdl2_dev_file = $py35+"\kivy.deps.sdl2_dev-0.1.13-cp35-cp35m-win_amd64.whl"
+        $glew_file = $py35+"\kivy.deps.glew-0.1.5-cp35-cp35m-win_amd64.whl"
+        $glew_dev_file = $py35+"\kivy.deps.glew_dev-0.1.5-cp35-cp35m-win_amd64.whl"
+      } else {
+        $sdl2_url = "0B-080DPVLKs2TGg0SXcwX1p1OHc"
+        $sdl2_dev_url = "0B-080DPVLKs2bjIyVDN3S0c0c0U"
+        $glew_url = "0B-080DPVLKs2dkdoS2t1cU9PZmc"
+        $glew_dev_url = "0B-080DPVLKs2QUZZNDNvem9meU0"
+        $sdl2_file = $py35+"\kivy.deps.sdl2-0.1.13-cp35-cp35m-win32.whl"
+        $sdl2_dev_file = $py35+"\kivy.deps.sdl2_dev-0.1.13-cp35-cp35m-win32.whl"
+        $glew_file = $py35+"\kivy.deps.glew-0.1.5-cp35-cp35m-win32.whl"
+        $glew_dev_file = $py35+"\kivy.deps.glew_dev-0.1.5-cp35-cp35m-win32.whl"
+      }
+      Check-Error
+      mkdir "$py35"
+      Check-Error
+      git clone -q --branch=feature-gl-backend https://github.com/kivy/kivy.git C:\projects\kivy_temp
+      Check-Error
+      Check-Error
+      (new-object net.webclient).DownloadFile("https://docs.google.com/uc?id="+$sdl2_url, $sdl2_file)
+      Check-Error
+      (new-object net.webclient).DownloadFile("https://docs.google.com/uc?id="+$sdl2_dev_url, $sdl2_dev_file)
+      Check-Error
+      (new-object net.webclient).DownloadFile("https://docs.google.com/uc?id="+$glew_url, $glew_file)
+      Check-Error
+      (new-object net.webclient).DownloadFile("https://docs.google.com/uc?id="+$glew_dev_url, $glew_dev_file)
+      Check-Error
+      cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"&set' |
+      foreach {
+        if ($_ -match "=") {
+          $v = $_.split("="); set-item -force -path "ENV:\$($v[0])"  -value "$($v[1])"
+        }
+      }
+      Check-Error
+      write-host "`nMSVC variables set."
+      $env:MSSdk=1
+      $env:USE_SDL2=1
+      $env:USE_GSTREAMER=0
+      $env:DISTUTILS_USE_SDK=1
+      $env:LIB=$PYTHON_ROOT+"\libs;"+$env:LIB
+      $env:INCLUDE=$PYTHON_ROOT+"\include;"+$env:INCLUDE
 
 
+      python -m pip install pip wheel setuptools --upgrade
+      Check-Error
+      pip install mock cython pygments docutils nose $sdl2_file $sdl2_dev_file $glew_file $glew_dev_file
+      Check-Error
+
+      Copy-Item "$PYTHON_ROOT\Lib\site-packages\kivy\deps\*" -destination "$env:APPVEYOR_BUILD_FOLDER\kivy\deps" -recurse
+      Remove-Item "$PYTHON_ROOT\Lib\site-packages\kivy" -Force -Recurse
+      Remove-Item "$PYTHON_ROOT\Lib\site-packages\kivy.deps.*nspkg.pth"
+
+      python "C:\projects\kivy_temp\setup.py" build_ext --inplace
+      Check-Error
+    }
+
     if ($DO_WHEEL -eq "True") {
       python setup.py bdist_wheel -d "$env:WHEEL_DIR"
       Check-Error