Python scripts for quick start
parent
3f1f46bc7d
commit
234a0ced42
@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <https://unlicense.org>
|
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
from common_root import *
|
||||||
|
|
||||||
|
import os, json
|
||||||
|
|
||||||
|
fi = open(os.path.join(NeLQuickStartDir, "config_default.json"), "r")
|
||||||
|
NeLConfig = json.load(fi)
|
||||||
|
fi.close()
|
||||||
|
|
||||||
|
fi = open(os.path.join(NeLConfigDir, "config.json"), "r")
|
||||||
|
NeLUserConfig = json.load(fi)
|
||||||
|
if not "Paths" in NeLUserConfig:
|
||||||
|
NeLUserConfig["Paths"] = {}
|
||||||
|
if not "Tools" in NeLUserConfig["Paths"]:
|
||||||
|
NeLUserConfig["Paths"]["Tools"] = {}
|
||||||
|
NeLConfig["Paths"]["Tools"].update(NeLUserConfig["Paths"]["Tools"])
|
||||||
|
NeLUserConfig["Paths"]["Tools"] = NeLConfig["Paths"]["Tools"]
|
||||||
|
NeLConfig["Paths"].update(NeLUserConfig["Paths"])
|
||||||
|
NeLUserConfig["Paths"] = NeLConfig["Paths"]
|
||||||
|
NeLConfig.update(NeLUserConfig)
|
||||||
|
fi.close()
|
||||||
|
|
||||||
|
del NeLUserConfig
|
||||||
|
del fi
|
||||||
|
|
||||||
|
NeLCodeDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Code"])
|
||||||
|
if not os.path.isdir(NeLCodeDir):
|
||||||
|
exit("NeL Code directory (" + NeLCodeDir + ") does not exist.")
|
||||||
|
NeLLeveldesignDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Leveldesign"])
|
||||||
|
if not os.path.isdir(NeLLeveldesignDir):
|
||||||
|
exit("NeL Leveldesign directory (" + NeLLeveldesignDir + ") does not exist.")
|
||||||
|
NeLGraphicsDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Graphics"])
|
||||||
|
if not os.path.isdir(NeLGraphicsDir):
|
||||||
|
exit("NeL Graphics directory (" + NeLGraphicsDir + ") does not exist.")
|
||||||
|
NeLSoundDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Sound"])
|
||||||
|
if not os.path.isdir(NeLSoundDir):
|
||||||
|
exit("NeL Sound directory (" + NeLSoundDir + ") does not exist.")
|
||||||
|
NeLBuildDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Build"])
|
||||||
|
if not os.path.isdir(NeLBuildDir):
|
||||||
|
exit("NeL Build directory (" + NeLBuildDir + ") does not exist.")
|
||||||
|
NeLPipelineDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Pipeline"])
|
||||||
|
if not os.path.isdir(NeLPipelineDir):
|
||||||
|
exit("NeL Pipeline directory (" + NeLPipelineDir + ") does not exist.")
|
||||||
|
NeLExternalDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["External"])
|
||||||
|
if not os.path.isdir(NeLExternalDir):
|
||||||
|
exit("NeL External directory (" + NeLExternalDir + ") does not exist.")
|
||||||
|
|
||||||
|
NeLPython27Dir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["Python27"])
|
||||||
|
NeLRRDtoolDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["RRDtool"])
|
||||||
|
NeLMariaDBDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["MariaDB"])
|
||||||
|
NeLNginxDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["Nginx"])
|
||||||
|
NeLPHPDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["PHP"])
|
||||||
|
NeLphpMyAdminDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["phpMyAdmin"])
|
||||||
|
NeL3dsMaxDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Tools"]["3dsMax"])
|
||||||
|
|
||||||
|
#print(NeLRootDir)
|
||||||
|
#print(NeLConfigDir)
|
||||||
|
#print(NeLConfig["Domain"])
|
||||||
|
#print(NeLConfig["Paths"]["Code"])
|
||||||
|
|
||||||
|
#print(NeLExternalDir)
|
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
NeLQuickStartDir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
def findNeLRootRecurse(dirPath):
|
||||||
|
configDir = os.path.join(dirPath, ".nel")
|
||||||
|
if os.path.isdir(configDir):
|
||||||
|
return dirPath
|
||||||
|
parentPath = os.path.dirname(dirPath)
|
||||||
|
if parentPath == dirPath:
|
||||||
|
exit("NeL Root folder (.nel) not found in folder hierarchy.")
|
||||||
|
return findNeLRootRecurse(parentPath)
|
||||||
|
|
||||||
|
def findNeLRoot():
|
||||||
|
return findNeLRootRecurse(NeLQuickStartDir)
|
||||||
|
|
||||||
|
NeLRootDir = findNeLRoot()
|
||||||
|
NeLConfigDir = os.path.join(NeLRootDir, ".nel")
|
||||||
|
|
||||||
|
del findNeLRootRecurse
|
||||||
|
del findNeLRoot
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"Domain": "default",
|
||||||
|
"Paths": {
|
||||||
|
"Code": "code",
|
||||||
|
"Leveldesign": "leveldesign",
|
||||||
|
"Graphics": "graphics",
|
||||||
|
"Sound": "sound",
|
||||||
|
"Build": "build",
|
||||||
|
"Pipeline": "pipeline",
|
||||||
|
"External": "external",
|
||||||
|
"Tools": {
|
||||||
|
"Python27": "external/python27",
|
||||||
|
"RRDtool": "external/rrdtool",
|
||||||
|
"MariaDB": "external/mariadb",
|
||||||
|
"Nginx": "external/nginx",
|
||||||
|
"PHP": "external/php",
|
||||||
|
"phpMyAdmin": "external/phpmyadmin",
|
||||||
|
"3dsMax": "C:\\Program Files\\Autodesk\\3ds Max 2022",
|
||||||
|
"VisualStudio32": "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0",
|
||||||
|
"VisualStudio64": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
|
||||||
|
# This script finds all Visual Studio installations
|
||||||
|
# [ { DisplayName, Path, HasMFC } ]
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
FoundVisualStudio = []
|
||||||
|
|
||||||
|
# C:\Program Files (x86)\Microsoft Visual Studio\VC98
|
||||||
|
# "C:\Program Files (x86)\Microsoft Visual Studio\VC98\MFC\Include\AFX.H"
|
||||||
|
|
||||||
|
VSVersions = {}
|
||||||
|
VSVersions[8] = 2005
|
||||||
|
VSVersions[9] = 2008
|
||||||
|
VSVersions[10] = 2010
|
||||||
|
VSVersions[11] = 2012
|
||||||
|
VSVersions[12] = 2013
|
||||||
|
VSVersions[13] = 2014
|
||||||
|
VSVersions[14] = 2015
|
||||||
|
#VSVersions[15] = 2017
|
||||||
|
#VSVersions[16] = 2019
|
||||||
|
#VSVersions[17] = 2022
|
||||||
|
|
||||||
|
# "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\afx.h"
|
||||||
|
# "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include\afx.h"
|
||||||
|
# "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\*\atlmfc\include\afx.h"
|
||||||
|
def HasMFC(dir):
|
||||||
|
if os.path.isfile(os.path.join(dir, "VC\\atlmfc\\include\\afx.h")):
|
||||||
|
return True
|
||||||
|
msvcTools = os.path.join(dir, "VC\\Tools\\MSVC")
|
||||||
|
res = []
|
||||||
|
if os.path.isdir(msvcTools):
|
||||||
|
for version in os.listdir(msvcTools):
|
||||||
|
if version.startswith("."):
|
||||||
|
continue
|
||||||
|
versionPath = os.path.join(msvcTools, version)
|
||||||
|
if os.path.isdir(versionPath):
|
||||||
|
headerPath = os.path.join(versionPath, "atlmfc\\include\\afx.h")
|
||||||
|
if os.path.isfile(headerPath):
|
||||||
|
res += [ version ]
|
||||||
|
if len(res):
|
||||||
|
return res
|
||||||
|
return False
|
||||||
|
|
||||||
|
# "C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe" # Visual C++ 2005 Express
|
||||||
|
# C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe" # Visual Studio 2022 Professional
|
||||||
|
# C:\Program Files\Microsoft Visual Studio\*\*\Common7\IDE\devenv.exe"
|
||||||
|
# "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" # Visual Studio 2008 Professional Edition
|
||||||
|
# Community, Professional, Enterprise
|
||||||
|
# Scan all folders 8 to 14, 8.0 to 14.0
|
||||||
|
for majorVersion in range(8, 15):
|
||||||
|
folderA = "C:\\Program Files (x86)\\Microsoft Visual Studio " + str(majorVersion)
|
||||||
|
folderB = folderA + ".0"
|
||||||
|
if os.path.isfile(os.path.join(folderA, "Common7\IDE\VCExpress.exe")):
|
||||||
|
FoundVisualStudio += [ { "DisplayName": "Visual C++ " + str(VSVersions[majorVersion]) + " Express", "Path": folderA, "HasMFC": HasMFC(folderB) } ]
|
||||||
|
if os.path.isfile(os.path.join(folderB, "Common7\IDE\VCExpress.exe")):
|
||||||
|
FoundVisualStudio += [ { "DisplayName": "Visual C++ " + str(VSVersions[majorVersion]) + " Express", "Path": folderB, "HasMFC": HasMFC(folderB) } ]
|
||||||
|
if os.path.isfile(os.path.join(folderA, "Common7\IDE\devenv.exe")):
|
||||||
|
FoundVisualStudio += [ { "DisplayName": "Visual Studio " + str(VSVersions[majorVersion]), "Path": folderA, "HasMFC": HasMFC(folderB) } ]
|
||||||
|
if os.path.isfile(os.path.join(folderB, "Common7\IDE\devenv.exe")):
|
||||||
|
FoundVisualStudio += [ { "DisplayName": "Visual Studio " + str(VSVersions[majorVersion]), "Path": folderB, "HasMFC": HasMFC(folderB) } ]
|
||||||
|
|
||||||
|
# Scan all folders 2017 to 2022
|
||||||
|
for yearVersion in os.listdir("C:\\Program Files (x86)\\Microsoft Visual Studio"):
|
||||||
|
if yearVersion.startswith("."):
|
||||||
|
continue
|
||||||
|
yearPath = os.path.join("C:\\Program Files (x86)\\Microsoft Visual Studio", yearVersion)
|
||||||
|
if os.path.isdir(yearPath):
|
||||||
|
for edition in os.listdir(yearPath):
|
||||||
|
if edition.startswith("."):
|
||||||
|
continue
|
||||||
|
editionPath = os.path.join(yearPath, edition)
|
||||||
|
if os.path.isdir(editionPath) and os.path.isfile(os.path.join(editionPath, "Common7\IDE\devenv.exe")):
|
||||||
|
FoundVisualStudio += [ { "DisplayName": "Visual Studio " + yearVersion + " " + edition, "Path": editionPath, "HasMFC": HasMFC(editionPath) } ]
|
||||||
|
for yearVersion in os.listdir("C:\\Program Files\\Microsoft Visual Studio"):
|
||||||
|
if yearVersion.startswith("."):
|
||||||
|
continue
|
||||||
|
yearPath = os.path.join("C:\\Program Files\\Microsoft Visual Studio", yearVersion)
|
||||||
|
if os.path.isdir(yearPath):
|
||||||
|
for edition in os.listdir(yearPath):
|
||||||
|
if edition.startswith("."):
|
||||||
|
continue
|
||||||
|
editionPath = os.path.join(yearPath, edition)
|
||||||
|
if os.path.isdir(editionPath) and os.path.isfile(os.path.join(editionPath, "Common7\IDE\devenv.exe")):
|
||||||
|
FoundVisualStudio += [ { "DisplayName": "Visual Studio " + yearVersion + " " + edition, "Path": editionPath, "HasMFC": HasMFC(editionPath) } ]
|
||||||
|
|
||||||
|
# print(FoundVisualStudio)
|
@ -0,0 +1 @@
|
|||||||
|
..\..\..\external\python27\python.exe find_vstudio.py
|
Loading…
Reference in New Issue