コード例 #1
0
 def Check(self):
     path = join(self.buildSetup.sourceDir, self.name)
     wantedVersion = tuple(int(x) for x in self.version.split("."))
     if not os.path.exists(path) or GetFileVersion(path) != wantedVersion:
         self.TryCopy()
         if GetFileVersion(path) != wantedVersion:
             raise WrongVersion
コード例 #2
0
ファイル: CheckDependencies.py プロジェクト: maffe/EventGhost
    def Check(self):
        with open(join(self.buildSetup.pyVersionDir, "Manifest.xml")) as f:
            manifest = f.read()
        match = re.search(
            'name="(?P<name>.+\.CRT)"\n'
            '\s*version="(?P<ver>.+)"\n'
            '\s*processorArchitecture="(?P<arch>.+)"',
            manifest
        )
        self.exact = True
        self.version = match.group("ver")
        wantedVersion = tuple(int(x) for x in self.version.split("."))

        files = glob.glob(
            join(
                os.environ["SystemRoot"],
                "WinSxS",
                "{2}_{0}_*_{1}_*_*".format(
                    *match.groups()
                ),
                "*.dll",
            )
        )

        if len(files):
            for file in files:
                if GetFileVersion(file) != wantedVersion:
                    raise WrongVersion
                else:
                    dest = join(self.buildSetup.sourceDir, basename(file))
                    copy2(file, dest)
        else:
            raise MissingDependency