Exemplo n.º 1
0
    def _process_platform_options(self):
        system = self.options.system
        architecture = self.options.architecture
        platform = self.options.platform
        if platform and (system or architecture):
            fail('Specify --platform alone or both --system and --architecture, not a mix.')
        if bool(system) != bool(architecture):
            fail('Specify --system and --architecture together.')
        if platform is None and system is not None:
            platform = system + '-' + architecture
        if platform is None and self.options.auto:
            platform = self.env['slave']
            #  to map non-standard platform slave labels to standard ones in auto behaviour e.g. Android-mono -> Android-anycpu
            if platform in self.platform_slave_overrides:
                platform = self.platform_slave_overrides[platform]
        if platform is None:
            platform = default_platform()
        if '-' not in platform:
            fail('Platform should be a system and an architecture separated by a hyphen, e.g. Windows-x86.')

        system, architecture = platform.split('-', 2)
        self.env['OH_PLATFORM'] = platform
        self.platform = platform
        self.system = system
        self.architecture = architecture
Exemplo n.º 2
0
def _get_platform_hacked_conda_command(extra_args, platform):
    """Get conda command and a string representing it in error messages."""
    if platform == current_platform() or platform is None:
        cmd_list = _get_conda_command(extra_args)
        return (cmd_list, " ".join(cmd_list))
    else:
        (platform_name, bits) = platform.split("-")

        conda_code = _platform_hacked_conda_code(platform_name, bits)

        # this has to run with the python from the root env,
        # so the conda modules will be found.
        root_prefix = _get_root_prefix()
        root_python = None
        for location in (('bin', 'python'), ('python.exe', ),
                         ('Scripts', 'python.exe'), ('Library', 'bin',
                                                     'python.exe')):
            candidate = os.path.join(root_prefix, *location)
            if os.path.isfile(candidate):
                root_python = candidate
                break
        assert root_python is not None

        cmd_list = [root_python, '-c', conda_code]
        cmd_list.extend(extra_args)
        return (cmd_list, " ".join(["conda"] + cmd_list[3:]))
Exemplo n.º 3
0
    def intersect_and_solve(cls, platform, candidates, conflictSolve=lambda x: x[0]):
        """ Given a platform name from BaseOsFactory.get_platform() or similar, and
        candidate names (ex: ["fedora 13 goddard", "ubuntu 9.10 karmic"]), this method
        will return the largest intersection of both lists and use conflictSolve to
        resolve conflicts when there are several intersections with the same number
        of items."""

        assert platform is not None
        #We find the right distribution class by intersecting
        #the platform description with the X_X_PackageNames classes
        #whose names are mangled.
        #the correct disctribution class is the one with which the
        #intersection is the largest. If there's equality between two
        #the conflict is solved using the conflictSolve function.
        platform = platform.split(" ")
        maxIntersectionAmount  = 0
        maxIntersectionDistrib = None
        for dist in candidates:
            intersections = cls.intersect_platform_names(platform, dist.split(" "))[0]
            numInters = len(intersections)
            if numInters > maxIntersectionAmount:
                maxIntersectionAmount = numInters
                maxIntersectionDistrib = dist
            elif numInters == maxIntersectionAmount and numInters > 0:
                if isinstance(maxIntersectionDistrib, list):
                    maxIntersectionDistrib.append(dist)
                elif maxIntersectionDistrib is not None:
                    maxIntersectionDistrib = [maxIntersectionDistrib, dist]
                else:
                    maxIntersectionDistrib = dist
        if isinstance(maxIntersectionDistrib, list):
            maxIntersectionDistrib = conflictSolve(maxIntersectionDistrib)
        return maxIntersectionDistrib
Exemplo n.º 4
0
    def intersect_and_solve(cls, platform, candidates, conflictSolve=lambda x: x[0], sep=" "):
        """ Given a platform name from BaseOsFactory.get_platform() or similar, and
        candidate names (ex: ["fedora 13 goddard", "ubuntu 9.10 karmic"]), this method
        will return the largest intersection of both lists and use conflictSolve to
        resolve conflicts when there are several intersections with the same number
        of items."""

        assert platform is not None
        #We find the right distribution class by intersecting
        #the platform description with the X_X_PackageNames classes
        #whose names are mangled.
        #the correct disctribution class is the one with which the
        #intersection is the largest. If there's equality between two
        #the conflict is solved using the conflictSolve function.
        platform = platform.split(" ")
        maxIntersectionAmount  = 0
        maxIntersectionDistrib = None
        for dist in candidates:
            intersections = cls.intersect_platform_names(platform, dist.split(sep))[0]
            numInters = len(intersections)
            if numInters > maxIntersectionAmount:
                maxIntersectionAmount = numInters
                maxIntersectionDistrib = dist
            elif numInters == maxIntersectionAmount and numInters > 0:
                if isinstance(maxIntersectionDistrib, list):
                    maxIntersectionDistrib.append(dist)
                elif maxIntersectionDistrib is not None:
                    maxIntersectionDistrib = [maxIntersectionDistrib, dist]
                else:
                    maxIntersectionDistrib = dist
        if isinstance(maxIntersectionDistrib, list):
            maxIntersectionDistrib = conflictSolve(maxIntersectionDistrib)
        return maxIntersectionDistrib
Exemplo n.º 5
0
    def _process_platform_options(self):
        system = self.options.system
        architecture = self.options.architecture
        platform = self.options.platform
        if platform and (system or architecture):
            fail(
                'Specify --platform alone or both --system and --architecture, not a mix.'
            )
        if bool(system) != bool(architecture):
            fail('Specify --system and --architecture together.')
        if platform is None and system is not None:
            platform = system + '-' + architecture
        if platform is None and self.options.auto:
            platform = self.env['slave']
            #  to map non-standard platform slave labels to standard ones in auto behaviour e.g. Android-mono -> Android-anycpu
            if platform in self.platform_slave_overrides:
                platform = self.platform_slave_overrides[platform]
        if platform is None:
            platform = default_platform()
        if '-' not in platform:
            fail(
                'Platform should be a system and an architecture separated by a hyphen, e.g. Windows-x86.'
            )

        system, architecture = platform.split('-', 2)
        self.env['OH_PLATFORM'] = platform
        self.platform = platform
        self.system = system
        self.architecture = architecture
Exemplo n.º 6
0
    def push(self, tag, platform):
        arch = platform.split("/")[1]  # amd64, arm64
        arch_tag = f"{tag}__{arch}"
        run(f"docker tag {tag} {arch_tag}")

        output = run("docker push {}".format(arch_tag), capture_output=True)
        last_line = output.decode().splitlines()[-1]
        p = re.compile(r"^(.*): digest: (.*) size: (\d+)$")
        m = p.match(last_line)
        digest = m.group(2)
        print(digest)

        print("Updating manifest list", tag)
        os.environ["DOCKER_CLI_EXPERIMENTAL"] = "enabled"

        repo, _ = tag.split(":")
        subprocess.run(f"docker manifest rm {tag}",
                       shell=True,
                       stdout=subprocess.DEVNULL,
                       stderr=subprocess.DEVNULL)

        manifests = self.get_manifests(tag)
        manifests[platform] = digest
        tags = []
        for p, digest in manifests.items():
            tags.append("{}@{}".format(repo, digest))

        run("docker manifest create {} {}".format(tag, " ".join(tags)))
        run("docker manifest push -p {}".format(tag))
 def get_components(self, platform):
     components = platform.split("-")
     if len(components) != 4:
         print(
             f"Given platform {platform} doesn't follow standard arch-OS-compiler-buildtype schema."
         )
         sys.exit(1)
     return components
Exemplo n.º 8
0
 def is_match(self, platform):
     """@brief Test to see if this ifile is part of platform
     @param platform The target platform. Eg, windows or linux/i686/gcc/3.3
     @return Returns True if the ifile is in the platform.
     """
     if self.platform_path[0] == 'common':
         return True
     req_platform_path = platform.split('/')
     #print "platform:",req_platform_path
     #print "path:",self.platform_path
     # to match, every path part much match
     match_count = min(len(req_platform_path), len(self.platform_path))
     for ii in range(0, match_count):
         if req_platform_path[ii] != self.platform_path[ii]:
             return False
     #print "match!"
     return True
Exemplo n.º 9
0
 def is_match(self, platform):
     """@brief Test to see if this ifile is part of platform
     @param platform The target platform. Eg, windows or linux/i686/gcc/3.3
     @return Returns True if the ifile is in the platform.
     """
     if self.platform_path[0] == 'common':
         return True
     req_platform_path = platform.split('/')
     #print "platform:",req_platform_path
     #print "path:",self.platform_path
     # to match, every path part much match
     match_count = min(len(req_platform_path), len(self.platform_path))
     for ii in range(0, match_count):
         if req_platform_path[ii] != self.platform_path[ii]:
             return False
     #print "match!"
     return True
Exemplo n.º 10
0
    def get_platform(self):
        platform = self.full_config.get_lit_conf('platform')
        if platform:
            platform = re.sub(r'([^0-9]+)([0-9\.]*)', r'\1-\2', platform)
            name, version = tuple(platform.split('-', 1))
        else:
            name = 'macosx'
            version = None

        if version:
            return (False, name, version)

        # Infer the version, either from the SDK or the system itself.  For
        # macosx, ignore the SDK version; what matters is what's at
        # /usr/lib/libc++.dylib.
        if name == 'macosx':
            version = self.get_macosx_version()
        else:
            version = self.get_sdk_version(name)
        return (True, name, version)
Exemplo n.º 11
0
    def get_platform(self):
        platform = self.full_config.get_lit_conf('platform')
        if platform:
            platform = re.sub(r'([^0-9]+)([0-9\.]*)', r'\1-\2', platform)
            name, version = tuple(platform.split('-', 1))
        else:
            name = 'macosx'
            version = None

        if version:
            return (False, name, version)

        # Infer the version, either from the SDK or the system itself.  For
        # macosx, ignore the SDK version; what matters is what's at
        # /usr/lib/libc++.dylib.
        if name == 'macosx':
            version = self.get_macosx_version()
        else:
            version = self.get_sdk_version(name)
        return (True, name, version)
Exemplo n.º 12
0
    def _process_platform_options(self):
        system = self.options.system
        architecture = self.options.architecture
        platform = self.options.platform
        if platform and (system or architecture):
            fail('Specify --platform alone or both --system and --architecture, not a mix.')
        if bool(system) != bool(architecture):
            fail('Specify --system and --architecture together.')
        if platform is None and system is not None:
            platform = system + '-' + architecture
        if platform is None and self.options.auto:
            platform = self.env['slave']
        if platform is None:
            platform = default_platform()
        if '-' not in platform:
            fail('Platform should be a system and an architecture separated by a hyphen, e.g. Windows-x86.')

        system, architecture = platform.split('-', 2)
        self.env['OH_PLATFORM'] = platform
        self.platform = platform
        self.system = system
        self.architecture = architecture
Exemplo n.º 13
0
    def _update_installable(self, name, platform, url, md5sum):
        """Update installable entry with specific package information.
        @param installable[in,out] a dict containing installable details. 
        @param platform Platform info, i.e. linux/i686, windows/i686 etc.
        @param url URL of tar file
        @param md5sum md5sum of tar file
        """
        installable  = self._installables[name]._definition
        path = platform.split('/')
        if 'packages' not in  installable:
            installable['packages'] = {}
        update = installable['packages']
        for child in path:
            if child not in update:
                update[child] = {}
            parent = update
            update = update[child]
        parent[child]['url'] = llsd.uri(url)
        parent[child]['md5sum'] = md5sum

        self._install_changed = True
        return True
Exemplo n.º 14
0
    def _update_installable(self, name, platform, url, md5sum):
        """Update installable entry with specific package information.
        @param installable[in,out] a dict containing installable details. 
        @param platform Platform info, i.e. linux/i686, windows/i686 etc.
        @param url URL of tar file
        @param md5sum md5sum of tar file
        """
        installable  = self._installables[name]._definition
        path = platform.split('/')
        if 'packages' not in  installable:
            installable['packages'] = {}
        update = installable['packages']
        for child in path:
            if child not in update:
                update[child] = {}
            parent = update
            update = update[child]
        parent[child]['url'] = llsd.uri(url)
        parent[child]['md5sum'] = md5sum

        self._install_changed = True
        return True
Exemplo n.º 15
0
#!/usr/bin/env python
from __future__ import print_function 
import os, sys, platform, string, re


arch = platform.machine()
system = platform.system()

if len(sys.argv) < 2 :
  print('Usage: getCompatible.py <platform>')
  sys.exit(1)

platform =  sys.argv[1]

#x86_64-slc6-gcc44-fst
arch, osvers, compiler, btype = platform.split('-')

new_arch =  arch
new_osvers = osvers

if   (compiler == 'clang34') : new_compiler = 'gcc48'
elif (compiler == 'clang35') : new_compiler = 'gcc49'
elif (compiler == 'clang36') : new_compiler = 'gcc49'
elif (compiler == 'clang39') : new_compiler = 'gcc49'
elif (compiler.startswith('clang_gcc')) : new_compiler = compiler[6:]
elif (compiler == 'icc') : new_compiler = 'gcc48'
elif (compiler == 'icc14') : new_compiler = 'gcc48'
elif (compiler == 'icc15') : new_compiler = 'gcc49'
elif (compiler == 'icc16') : new_compiler = 'gcc49'
elif (compiler == 'icc17') : new_compiler = 'gcc62'
else : new_compiler = compiler
Exemplo n.º 16
0
def fetch_dependencies(dependency_names=None,
                       platform=None,
                       env=None,
                       fetch=True,
                       clean=True,
                       source=False,
                       list_details=False,
                       local_overrides=True,
                       verbose=False):
    '''
    Fetch all the dependencies defined in projectdata/dependencies.json and in
    projectdata/packages.config.
    platform:
        Name of target platform. E.g. 'Windows-x86', 'Linux-x64', 'Mac-x64'...
    env:
        Extra variables referenced by the dependencies file.
    fetch:
        True to fetch the listed dependencies, False to skip.
    clean:
        True to clean out directories before fetching, False to skip.
    source:
        True to fetch source for the listed dependencies, False to skip.
    '''
    if env is None:
        env = {}

    if platform is not None:
        env['platform'] = None
        fName = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                             'platforms.txt')
        f = open(fName, 'rt')
        supported = f.readlines()
        f.close()
        for entry in supported:
            if platform in entry:
                env['platform'] = platform
        if not env['platform']:
            raise Exception(
                'Platform not supported (%s) - see %s for list of supported platforms'
                % (platform, fName))
    if 'platform' not in env:
        platform = env['platform'] = default_platform()
    if '-' in platform:
        env['system'], env['architecture'] = platform.split('-', 2)
    if platform is None:
        raise Exception('Platform not specified and unable to guess.')

    if clean and not list_details:
        try:
            os.unlink('dependencies/loadedDeps.json')
        except:
            pass
        clean_dirs('dependencies')

    overrides_filename = '../dependency_overrides.json' if local_overrides else None
    dependencies = read_json_dependencies_from_filename(
        'projectdata/dependencies.json', overrides_filename, env=env)
    if list_details:
        for name, dependency in dependencies.items():
            print("Dependency '{0}':".format(name))
            print("    fetches from:     {0!r}".format(
                dependency['archive-path']))
            print("    unpacks to:       {0!r}".format(dependency['dest']))
            print("    local override:   {0}".format(
                "YES (see '../dependency_overrides.json')" if dependency.
                has_overrides else 'no'))
            if verbose:
                print("    all keys:")
                for key, value in sorted(dependency.items()):
                    print("        {0} = {1!r}".format(key, value))
            print("")
    else:
        if fetch:
            if not dependencies.fetch(dependency_names):
                raise Exception("Failed to load requested dependencies")

        if source:
            dependencies.checkout(dependency_names)

    # Finally perform cross-check of (major.minor) dependency versions to ensure that these are in sync
    # across this (current) repo and all its pulled-in dependencies. Done as totally seperate operation
    # to isolate from the main fetcher code to assist with any future maintenance
    if not clean:
        xcheck = deps_cross_checker.DepsCrossChecker(platform)
        result = xcheck.execute()
        if result != 0:
            raise Exception(
                'Failed: dependency cross-checker detected problem(s)')

    return dependencies
Exemplo n.º 17
0
def get_min_sdk_version(platform):
    return int(platform.split("-")[1])
Exemplo n.º 18
0
def get_platform(platform):
    return int(platform.split("-")[1])
Exemplo n.º 19
0
  A string encoding the runtime platform.  It consists of five parts separated
  by dash: platform, os, architecture, data-width, endianness

  E.g. ``darwin-posix-i386-32bit-le``
"""


def _make_platform():
    # runtime identifier: platform, os, architecture, data-width, endianness
    # e.g. darwin-posix-i386-32bit-le
    import os, sys, platform, re

    machine = platform.machine()
    width = platform.architecture()[0]
    platform = "%s-%s-%s-%s-%s" % (
        sys.platform,
        os.name,
        re.compile(r"^i[3456]86$").sub("i386", machine),
        width,
        "le" if sys.byteorder == "little" else "be",
    )
    platform = platform.lower()
    return platform


platform = _make_platform()
assert len(platform.split("-")) == 5

if __name__ == "__main__":
    print platform
Exemplo n.º 20
0
    """
  Determine and return DIRAC name for current site
  """
    global __siteName
    if not __siteName:
        __siteName = gConfig.getValue('/LocalSite/Site', _siteName)
    return __siteName


#Callbacks
ExitCallback.registerSignals()

#Set the platform
from DIRAC.Core.Utilities.Platform import getPlatformString
platform = getPlatformString()
platformTuple = tuple(platform.split('_'))


def exit(exitCode=0):
    """
  Finish execution using callbacks
  """
    ExitCallback.execute(exitCode, [])
    sys.exit(exitCode)


def abort(exitCode, *args, **kwargs):
    """
  Abort execution
  """
    try:
Exemplo n.º 21
0
Arquivo: detect.py Projeto: 93i/godot
def get_platform(platform):
    return int(platform.split("-")[1])
Exemplo n.º 22
0
def siteName():
  """
  Determine and return DIRAC name for current site
  """
  global __siteName
  if not __siteName:
    __siteName = gConfig.getValue( '/LocalSite/Site', _siteName )
  return __siteName

#Callbacks
ExitCallback.registerSignals()

#Set the platform
from DIRAC.Core.Utilities.Platform import getPlatformString
platform = getPlatformString()
platformTuple = tuple( platform.split( '_' ) )

def exit( exitCode = 0 ):
  """
  Finish execution using callbacks
  """
  ExitCallback.execute( exitCode, [] )
  sys.exit( exitCode )

def abort( exitCode, *args, **kwargs ):
  """
  Abort execution
  """
  try:
    gLogger.fatal( *args, **kwargs )
    os._exit( exitCode )
Exemplo n.º 23
0
 def get_components(self,platform):
     components = platform.split("-")
     if len(components) != 4:
       print "Given platform '%s' doesn't follow standard arch-OS-compiler-buildtype schema." %platform
       sys.exit(1)
     return components
Exemplo n.º 24
0
  Determine and return DIRAC name for current site
  """
    global __siteName
    if not __siteName:
        __siteName = gConfig.getValue("/LocalSite/Site", _siteName)
    return __siteName


# Callbacks
ExitCallback.registerSignals()

# Set the platform
from DIRAC.Core.Utilities.Platform import getPlatformString

platform = getPlatformString()
platformTuple = tuple(platform.split("_"))


def exit(exitCode=0):
    """
  Finish execution using callbacks
  """
    ExitCallback.execute(exitCode, [])
    sys.exit(exitCode)


def abort(exitCode, *args, **kwargs):
    """
  Abort execution
  """
    try:
Exemplo n.º 25
0
def fetch_dependencies(dependency_names=None,
                       platform=None,
                       env=None,
                       fetch=True,
                       nuget=True,
                       clean=True,
                       source=False,
                       logfile=None,
                       list_details=False,
                       local_overrides=True,
                       verbose=False):
    '''
    Fetch all the dependencies defined in projectdata/dependencies.json and in
    projectdata/packages.config.
    platform:
        Name of target platform. E.g. 'Windows-x86', 'Linux-x64', 'Mac-x64'...
    env:
        Extra variables referenced by the dependencies file.
    fetch:
        True to fetch the listed dependencies, False to skip.
    nuget:
        True to fetch nuget packages listed in packages.config, False to skip.
    clean:
        True to clean out directories before fetching, False to skip.
    source:
        True to fetch source for the listed dependencies, False to skip.
    logfile:
        File-like object for log messages.
    '''
    if env is None:
        env = {}
    if platform is not None:
        env['platform'] = platform
    if 'platform' not in env:
        platform = env['platform'] = default_platform()
    if '-' in platform:
        env['system'], env['architecture'] = platform.split('-', 2)

    if platform is None:
        raise Exception('Platform not specified and unable to guess.')
    if clean and not list_details:
        clean_dirs = []
        if fetch:
            clean_dirs += [
                'dependencies/AnyPlatform', 'dependencies/' + platform
            ]
        if nuget:
            clean_dirs += ['dependencies/nuget']
        clean_directories(clean_dirs)

    overrides_filename = '../dependency_overrides.json' if local_overrides else None
    dependencies = read_json_dependencies_from_filename(
        'projectdata/dependencies.json',
        overrides_filename,
        env=env,
        logfile=logfile)
    if list_details:
        for name, dependency in dependencies.items():
            print "Dependency '{0}':".format(name)
            print "    fetches from:     {0!r}".format(
                dependency['archive-path'])
            print "    unpacks to:       {0!r}".format(dependency['dest'])
            print "    local override:   {0}".format(
                "YES (see '../dependency_overrides.json')" if dependency.
                has_overrides else 'no')
            if verbose:
                print "    all keys:"
                for key, value in sorted(dependency.items()):
                    print "        {0} = {1!r}".format(key, value)
            print ""
    else:
        if fetch:
            dependencies.fetch(dependency_names)
        if nuget:
            if not os.path.exists('projectdata/packages.config'):
                print "Skipping NuGet invocation because projectdata/packages.config not found."
            else:
                nuget_exes = [
                    os.path.normpath(p) for p in glob(
                        'dependencies/AnyPlatform/NuGet.[0-9]*/NuGet.exe')
                ]
                if len(nuget_exes) == 0:
                    raise Exception(
                        "'NuGet.exe' not found, cannot fetch NuGet dependencies."
                    )
                nuget_exe = nuget_exes[0]
                if len(nuget_exes) > 1:
                    print "Warning: multiple copies of 'NuGet.exe' found. Using:"
                    print "    " + nuget_exe
                cli([
                    nuget_exe, 'install', 'projectdata/packages.config',
                    '-OutputDirectory', 'dependencies/nuget'
                ])
        if source:
            dependencies.checkout(dependency_names)
    return dependencies
Exemplo n.º 26
0
def fetch_dependencies(dependency_names=None, platform=None, env=None, fetch=True, nuget_packages=None, nuget_sln=None, nuget_config='nuget.config', clean=True, source=False, logfile=None, list_details=False, local_overrides=True, verbose=False):
    '''
    Fetch all the dependencies defined in projectdata/dependencies.json and in
    projectdata/packages.config.
    platform:
        Name of target platform. E.g. 'Windows-x86', 'Linux-x64', 'Mac-x64'...
    env:
        Extra variables referenced by the dependencies file.
    fetch:
        True to fetch the listed dependencies, False to skip.
    nuget:
        True to fetch nuget packages listed in packages.config, False to skip.
    clean:
        True to clean out directories before fetching, False to skip.
    source:
        True to fetch source for the listed dependencies, False to skip.
    logfile:
        File-like object for log messages.
    '''
    nuget = nuget_packages is not None or nuget_sln is not None
    if env is None:
        env = {}
    if platform is not None:
        env['platform'] = platform
    if 'platform' not in env:
        platform = env['platform'] = default_platform()
    if '-' in platform:
        env['system'], env['architecture'] = platform.split('-',2)

    if platform is None:
        raise Exception('Platform not specified and unable to guess.')
    if clean and not list_details:
        try:
            os.unlink('dependencies/loadedDeps.json')
        except:
            pass
        clean_dirs = ['dependencies']
        clean_directories(clean_dirs)

    overrides_filename = '../dependency_overrides.json' if local_overrides else None
    dependencies = read_json_dependencies_from_filename('projectdata/dependencies.json', overrides_filename, env=env, logfile=logfile)
    if list_details:
        for name, dependency in dependencies.items():
            print "Dependency '{0}':".format(name)
            print "    fetches from:     {0!r}".format(dependency['archive-path'])
            print "    unpacks to:       {0!r}".format(dependency['dest'])
            print "    local override:   {0}".format("YES (see '../dependency_overrides.json')" if dependency.has_overrides else 'no')
            if verbose:
                print "    all keys:"
                for key, value in sorted(dependency.items()):
                    print "        {0} = {1!r}".format(key, value)
            print ""
    else:
        if fetch:
            if not dependencies.fetch(dependency_names):
                raise Exception("Failed to load requested dependencies")

        if source:
            dependencies.checkout(dependency_names)

        if nuget_packages:
            # follow the legacy behaviour if a valid nuget packages.config file has been specified
            if not os.path.exists(nuget_packages):
                print "Skipping NuGet invocation because projectdata/packages.config not found."
            else:
                print "Fetching dependencies based on {0}".format(nuget_packages)
                nuget_exes = [os.path.normpath(p) for p in glob('dependencies/AnyPlatform/NuGet.[0-9]*/NuGet.exe')]
                if len(nuget_exes) == 0:
                    raise Exception("'NuGet.exe' not found, cannot fetch NuGet dependencies.")
                nuget_exe = nuget_exes[0]
                if len(nuget_exes) > 1:
                    print "Warning: multiple copies of 'NuGet.exe' found. Using:"
                    print "    " + nuget_exe
                cli([nuget_exe, 'install', nuget_packages, '-OutputDirectory', 'dependencies/nuget'])
        elif nuget_sln:
            if not os.path.exists(nuget_sln):
                print "Skipping NuGet invocation because {0} not found.".format(nuget_sln)
            else:
                print "Fetching dependencies based on {0}".format(nuget_sln)
                # recursive lookup of the nuget.config file does not work on linux... So,
                # the location of the file needs to be specified explicitly
                args = ['../ohdevtools/nuget/nuget.exe', 'restore', nuget_sln]
                if nuget_config is not None and os.path.isfile(nuget_config):
                    args += ['-ConfigFile', nuget_config]
                cli(args)

    # Finally perform cross-check of (major.minor) dependency versions to ensure that these are in sync
    # across this (current) repo and all its pulled-in dependencies. Done as totally seperate operation
    # to isolate from the main fetcher code to assist with any future maintenance
    if not clean:
        xcheck = deps_cross_checker.DepsCrossChecker( platform )
        result = xcheck.execute()
        if result != 0:
            raise Exception( 'Failed: dependency cross-checker detected problem(s)' )

    return dependencies
Exemplo n.º 27
0
  A string encoding the runtime platform.  It consists of five parts separated
  by dash: platform, os, architecture, data-width, endianness

  E.g. ``darwin-posix-i386-32bit-le``
"""


def _make_platform():
    # runtime identifier: platform, os, architecture, data-width, endianness
    # e.g. darwin-posix-i386-32bit-le
    import os, sys, platform, re
    machine = platform.machine()
    width = platform.architecture()[0]
    platform = "%s-%s-%s-%s-%s" % (
        sys.platform,
        os.name,
        re.compile(r'^i[3456]86$').sub('i386', machine),
        width,
        'le' if sys.byteorder == 'little' else 'be',
    )
    platform = platform.lower()
    return platform


platform = _make_platform()
assert len(platform.split('-')) == 5

if __name__ == '__main__':
    print platform
Exemplo n.º 28
0
#!/usr/bin/env python
from __future__ import print_function
import os, sys, platform, string, re

arch = platform.machine()
system = platform.system()

if len(sys.argv) < 2:
    print('Usage: getCompatible.py <platform>')
    sys.exit(1)

platform = sys.argv[1]

#x86_64-slc6-gcc44-fst
arch, osvers, compiler, btype = platform.split('-')

new_arch = arch
new_osvers = osvers

if (compiler == 'clang34'): new_compiler = 'gcc48'
elif (compiler == 'clang35'): new_compiler = 'gcc49'
elif (compiler == 'clang36'): new_compiler = 'gcc49'
elif (compiler == 'clang39'): new_compiler = 'gcc62'
elif (compiler == 'clang50'): new_compiler = 'gcc62'
elif (compiler.startswith('clang_gcc')):
    new_compiler = compiler[6:] if (osvers != 'mac1012') else "clang81"
elif (compiler == 'clang80'):
    new_compiler = 'clang81'
elif (compiler == 'icc'):
    new_compiler = 'gcc48'
elif (compiler == 'icc14'):