SHA256
3
0
forked from pool/cmake

Accepting request 440352 from home:alarrosa:branches:devel:tools:building

- Fix cmake.prov to report all cmake Config modules provided in a single
  cmake directory instead of just returning the first one given by a
  shell glob (which could be different across builds). Also, include
  upper and lowercase files always instead of including lowercase files
  only when no uppercase files were found.

OBS-URL: https://build.opensuse.org/request/show/440352
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=271
This commit is contained in:
Hrvoje Senjan 2016-11-15 10:31:10 +00:00 committed by Git OBS Bridge
parent 43f23f4c82
commit 5184b98e47
2 changed files with 23 additions and 19 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Nov 15 08:23:14 UTC 2016 - alarrosa@suse.com
- Fix cmake.prov to report all cmake Config modules provided in a single
cmake directory instead of just returning the first one given by a
shell glob (which could be different across builds). Also, include
upper and lowercase files always instead of including lowercase files
only when no uppercase files were found.
-------------------------------------------------------------------
Sun Sep 25 00:21:58 UTC 2016 - jimmy@boombatower.com

View File

@ -31,35 +31,30 @@ class CMakeParser:
paths = map(lambda x: x.rstrip(), filelist.readlines())
for path in paths:
modulePath, cmakeModule, lowercase = self.parseCmakeModuleConfig(path)
if modulePath and cmakeModule:
version = self.resolveCMakeModuleVersion(modulePath, cmakeModule, lowercase)
for (modulePath, cmakeModule, lowercase) in self.parseCmakeModuleConfig(path):
version = self.resolveCMakeModuleVersion(modulePath, cmakeModule, lowercase)
if version:
print("cmake(%s) = %s" % (cmakeModule, version))
print("cmake(%s) = %s" % (cmakeModule, version))
else:
print("cmake(%s)" % cmakeModule)
print("cmake(%s)" % cmakeModule)
def parseCmakeModuleConfig(self, configFile):
paths = configFile.rsplit("/", 3)
modulePath = "%s/cmake/%s" % (paths[0], paths[2])
lowercase = False
configFile = glob.glob("%s/*Config.cmake" % modulePath)
if not configFile:
configFile = glob.glob("%s/*-config.cmake" % modulePath)
lowercase = True
if not configFile:
return (None, None)
result = []
for configFile in glob.glob("%s/*Config.cmake" % modulePath):
moduleName = configFile[len(modulePath) + 1:-len("Config.cmake")]
result.append( (modulePath, moduleName, False) )
if lowercase:
moduleName = configFile[0][len(modulePath) + 1:-len("-config.cmake")]
else:
moduleName = configFile[0][len(modulePath) + 1:-len("Config.cmake")]
for configFile in glob.glob("%s/*-config.cmake" % modulePath):
moduleName = configFile[len(modulePath) + 1:-len("-config.cmake")]
if (modulePath, moduleName, False) not in result:
result.append( (modulePath, moduleName, True) )
return (modulePath, moduleName, lowercase)
return result
def resolveCMakeModuleVersion(self, modulePath, cmakeModule, lowercase):
versionFile = ("%s/%s-config-version.cmake" if lowercase else "%s/%sConfigVersion.cmake") % (modulePath, cmakeModule)