Beispiel #1
0
	def binariesPath(cls, version=None, architecture=64, language='English'):
		""" Finds the install path for various software installations.
		:param version: The version of the software. Default is None
		:param architecture: The bit type to query the registry for(32, 64). Default is 64
		:param language: Optional language that may be required for specific softwares.
		"""
		version = cls._yearForVersion.get(unicode(version), version)
		hive = 'HKEY_LOCAL_MACHINE'
		from cross3d.migrate import winregistry
		if version == None:
			# Get all of the installed versions so we can find the latest version.
			versions = winregistry.listRegKeys(hive, cls._hkeyBase, architecture=architecture)
			for v in sorted(versions, reverse=True):
				if v not in cls._ignoredVersions:
					version = v
					break
		hkey = r'{hkeyBase}\{version}'.format(hkeyBase=cls._hkeyBase, version=version)
		try:
			ret = winregistry.registryValue(hive, hkey, 'InstallPath', architecture)[0]
		except WindowsError:
			raise Exceptions.SoftwareNotInstalled('MotionBuilder', version=version, architecture=architecture, language=language)
		# If the version is not installed this will return '.', we want to return False.
		if ret:
			return os.path.normpath(ret)
		raise Exceptions.SoftwareNotInstalled('MotionBuilder', version=version, architecture=architecture, language=language)
Beispiel #2
0
    def binariesPath(cls, version=None, architecture=64, language='English'):
        """ Finds the install path for various software installations. If version is None, the default
		it will return the latest installed version of the software. Raises cross3d.Exceptions.SoftwareNotInstalled
		if the software is not installed.
		:param version: The version of the software. Default is None
		:param architecture: The bit type to query the registry for(32, 64). Default is 64
		:param language: Optional language that may be required for specific softwares.
		"""
        langId = cls._languageIDs.get(language, cls._languageIDs['English'])
        hive = 'HKEY_LOCAL_MACHINE'
        # Ensure we get a valid version number
        version = cls._versionForYear.get(unicode(version), version)
        from cross3d.migrate import winregistry
        if version == None:
            # Get all of the installed versions so we can find the latest version.
            versions = set(
                winregistry.listRegKeys(hive,
                                        cls._hkeyBase,
                                        architecture=architecture))
            # Years to ignore isnt very useful, convert them to version numbers ('14.0').
            # This allows the environment variable to remain the same for all of the software implemntations
            ignoredVersions = set([
                '{}.0'.format(cls._versionForYear[year])
                for year in cls._ignoredVersions if year in cls._versionForYear
            ])
            for v in sorted(versions, reverse=True):
                if v in versions and v not in ignoredVersions:
                    version = v.rsplit('.', 1)[0]
                    try:
                        float(version)
                    except ValueError:
                        # Not a valid version number. Most likely something like RegistryVersion19.0
                        continue
                    # Ignore all keys that don't store Installdir info.
                    hkey = cls._getHkey(version, langId)
                    try:
                        ret = winregistry.registryValue(
                            hive, hkey, 'Installdir', architecture)[0]
                        if not ret:
                            continue
                    except WindowsError:
                        continue
                    break
        dispVersion = cls._yearForVersion.get(unicode(version), version)
        hkey = cls._getHkey(version, langId)
        try:
            ret = winregistry.registryValue(hive, hkey, 'Installdir',
                                            architecture)[0]
        except WindowsError:
            raise Exceptions.SoftwareNotInstalled('Studiomax',
                                                  version=dispVersion,
                                                  architecture=architecture,
                                                  language=language)
        # If the version is not installed this will return '.', we want to return False.
        if ret:
            return os.path.normpath(ret)
        raise Exceptions.SoftwareNotInstalled('Studiomax',
                                              version=dispVersion,
                                              architecture=architecture,
                                              language=language)
Beispiel #3
0
    def binariesPath(cls, version=None, architecture=64, language='English'):
        """ Finds the install path for various software installations. If version is None, the default
		it will return the latest installed version of the software. Raises cross3d.Exceptions.SoftwareNotInstalled
		if the software is not installed.
		:param version: The version of the software. Default is None
		:param architecture: The bit type to query the registry for(32, 64). Default is 64
		:param language: Optional language that may be required for specific softwares.
		"""
        from cross3d.migrate import winregistry
        hive = 'HKEY_LOCAL_MACHINE'
        hkey = r'Software\Autodesk\Softimage\InstallPaths'
        ret = None
        if version == None:
            # Find the latest version
            versions = winregistry.listRegKeyValues(hive,
                                                    hkey,
                                                    architecture=architecture)
            for version in sorted(versions, key=lambda i: i[0], reverse=True):
                if version[0] not in cls._ignoredVersions:
                    ret = version[1]
                    break
        else:
            version = cls._yearForVersion.get(unicode(version), version)
            try:
                ret = winregistry.registryValue(hive, hkey, unicode(version),
                                                architecture)[0]
            except WindowsError:
                raise Exceptions.SoftwareNotInstalled(
                    'Softimage',
                    version=version,
                    architecture=architecture,
                    language=language)
        # If the version is not installed this will return '.', we want to return False.
        if ret:
            return os.path.join(os.path.normpath(ret), 'Application', 'bin')
        raise Exceptions.SoftwareNotInstalled('Softimage',
                                              version=version,
                                              architecture=architecture,
                                              language=language)