ソースを参照

Final commit to install

oscarleiva 5 年 前
コミット
aa89f02364
5 ファイル変更41 行追加27 行削除
  1. 25 0
      create_shortcut.py
  2. 14 9
      install.bat
  3. 1 17
      install_copy_files.py
  4. BIN
      mc3.exe
  5. 1 1
      run.bat

+ 25 - 0
create_shortcut.py

@@ -0,0 +1,25 @@
+import os
+import winshell
+from win32com.client import Dispatch
+
+
+def create_shortcut():
+    # creates shortcut
+    desktop = winshell.desktop()
+
+    path = os.path.join(desktop, "Predespacho Regional.lnk")
+    target = os.path.join(
+        os.environ["LOCALAPPDATA"], "Merelec", "spr", "run.bat")
+    wDir = desktop
+    icon = os.path.join(os.environ["LOCALAPPDATA"],
+                        "Merelec", "spr", "app.ico")
+    shell = Dispatch('WScript.Shell')
+    shortcut = shell.CreateShortCut(path)
+    shortcut.Targetpath = target
+    shortcut.WorkingDirectory = wDir
+    shortcut.IconLocation = icon
+    shortcut.save()
+
+
+if __name__ == "__main__":
+    create_shortcut()

+ 14 - 9
install.bat

@@ -1,21 +1,21 @@
 @echo off
 
+REM Verificar que no hay una versión anterior
+
 echo Instalando Python y paquetes necesarios
-echo Descargando Python...
-powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe', 'mc3.exe') }"
+REM echo Descargando Python...
+REM powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe', 'mc3.exe') }"
 
-echo Instalando Python
+echo Instalando Python...
 start /wait "" mc3.exe /InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%LOCALAPPDATA%\Merelec\spr\mc3
-
+echo Python se instalo correctamente...
 echo Verificando la version de Python
 
 %LOCALAPPDATA%\Merelec\spr\mc3\python.exe --version
 
 %LOCALAPPDATA%\Merelec\spr\mc3\python.exe install_copy_files.py
 
-Seteando variables para resolver el problema ssl
-echo
-echo
+
 echo Seteando variables de entorno...
 
 SET PATH=%PATH%;%LOCALAPPDATA%\Merelec\spr\mc3;%LOCALAPPDATA%\Merelec\spr\mc3\Scripts;%LOCALAPPDATA%\Merelec\spr\mc3\Library;%LOCALAPPDATA%\Merelec\spr\mc3\Library\bin
@@ -35,10 +35,15 @@ echo Instalando paquetes necesarios
 %LOCALAPPDATA%\Merelec\spr\mc3\Scripts\pip.exe install -r requirements.txt
 
 @echo off
-set ipopt=%LOCALAPPDATA%\Merelec\spr\ipopt
+echo Agregando IPOPT to Path
 
-echo Verificando instalación de python y Ipopt
+SET PATH=%PATH%;%LOCALAPPDATA%\Merelec\spr\ipopt\bin
+
+echo Verificando instalación de Ipopt
 
 ipopt --version
 
+echo Creando Acceso directo en el escritorio...
+%LOCALAPPDATA%\Merelec\spr\mc3\python.exe create_shortcut.py
+
 pause

+ 1 - 17
install_copy_files.py

@@ -2,8 +2,6 @@ import os
 import sys
 import shutil
 
-import winshell
-from win32com.client import Dispatch
 
 unrequired_files = ("install.bat", "install_copy_files.py",
                     "mc3.exe", "miniconda_install.bat", ".git")
@@ -25,21 +23,7 @@ def install():
                             "install.bat", "install_copy_files.py", "mc3.exe", "miniconda_install.bat", ".git"),
                         dirs_exist_ok=True)
 
-    # creates shortcut
-    desktop = winshell.desktop()
-
-    path = os.path.join(desktop, "Predespacho Regional.lnk")
-    target = os.path.join(
-        os.environ["LOCALAPPDATA"], "Merelec", "spr", "run.bat")
-    wDir = desktop
-    icon = os.path.join(os.environ["LOCALAPPDATA"],
-                        "Merelec", "spr", "app.ico")
-    shell = Dispatch('WScript.Shell')
-    shortcut = shell.CreateShortCut(path)
-    shortcut.Targetpath = target
-    shortcut.WorkingDirectory = wDir
-    shortcut.IconLocation = icon
-    shortcut.save()
+    
 
 
 if __name__ == "__main__":

BIN
mc3.exe


+ 1 - 1
run.bat

@@ -1,5 +1,5 @@
 @echo off
-call mc3/Scripts/activate.bat
+call %LOCALAPPDATA%\Merelec\spr\mc3\Scripts\activate.bat
 start /b %LOCALAPPDATA%\Merelec\spr\mc3\pythonw.exe main.py