Environment, paths fixes

pull/1283/head
Piero Toffanin 2021-05-15 14:21:55 -04:00
rodzic 86fb8dc84b
commit 8e40842d56
4 zmienionych plików z 58 dodań i 3 usunięć

Wyświetl plik

@ -129,6 +129,21 @@ def clean():
safe_remove(os.path.join("SuperBuild", "install"))
def dist():
# Download portable python
is not os.path.isdir("python38"):
python_url = "https://github.com/OpenDroneMap/windows-deps/releases/download/2.5.0/python-3.8.1-embed-amd64-less-pth.zip"
if not os.path.exists("python38.zip"):
print("Downloading %s" % python_url)
with urllib.request.urlopen(python_url) as response, open( "python38.zip", 'wb') as out_file:
shutil.copyfileobj(response, out_file)
os.mkdir("python38")
print("Extracting python38.zip --> python38/")
with zipfile.ZipFile("python38.zip") as z:
z.extractall("python38")
# Download innosetup
if not os.path.isdir("innosetup"):
innosetup_url = "https://github.com/OpenDroneMap/windows-deps/releases/download/2.5.0/innosetup-portable-win32-6.0.5-3.zip"

Wyświetl plik

@ -44,6 +44,7 @@ Source: "opendm\*"; DestDir: "{app}\opendm"; Excludes: "__pycache__"; Flags: ign
Source: "stages\*"; DestDir: "{app}\stages"; Excludes: "__pycache__"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "SuperBuild\install\bin\*"; DestDir: "{app}\SuperBuild\install\bin"; Excludes: "__pycache__"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "venv\*"; DestDir: "{app}\venv"; Excludes: "__pycache__"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "python38\*"; DestDir: "{app}\python38"; Excludes: "__pycache__"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "console.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "VERSION"; DestDir: "{app}"; Flags: ignoreversion
Source: "LICENSE"; DestDir: "{app}"; Flags: ignoreversion

Wyświetl plik

@ -63,11 +63,16 @@ def run(cmd, env_paths=[context.superbuild_bin_path], env_vars={}, packages_path
log.ODM_INFO('running %s' % cmd)
env = os.environ.copy()
sep = ":"
if sys.platform == 'win32':
sep = ";"
if len(env_paths) > 0:
env["PATH"] = env["PATH"] + ":" + ":".join(env_paths)
env["PATH"] = env["PATH"] + sep + sep.join(env_paths)
if len(packages_paths) > 0:
env["PYTHONPATH"] = env.get("PYTHONPATH", "") + ":" + ":".join(packages_paths)
env["PYTHONPATH"] = env.get("PYTHONPATH", "") + sep + sep.join(packages_paths)
for k in env_vars:
env[k] = str(env_vars[k])

Wyświetl plik

@ -1,7 +1,41 @@
@echo off
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
set _OLD_CODEPAGE=%%a
)
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" 65001 > nul
)
set ODMBASE=%~dp0
set GDALBASE=%ODMBASE%venv\Lib\site-packages\osgeo
set OSFMBASE=%ODMBASE%SuperBuild\install\bin\opensfm\bin
set PATH=%GDALBASE%;%ODMBASE%SuperBuild\install\bin;%OSFMBASE%
set PROJ_LIB=%GDALBASE%\data\proj
call venv\Scripts\activate
set VIRTUAL_ENV=%ODMBASE%venv
set PYTHONPATH=%VIRTUAL_ENV%
if not defined PROMPT set PROMPT=$P$G
if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT%
if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
set _OLD_VIRTUAL_PROMPT=%PROMPT%
set PROMPT=(venv) %PROMPT%
if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
set PYTHONHOME=
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH%
set PATH=%VIRTUAL_ENV%\Scripts;%VIRTUAL_ENV%\..;%PATH%
:END
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
set _OLD_CODEPAGE=
)