Ejemplo n.º 1
0
    def add_buildout(self, data, host, checksum):
        packages = []

        for package_info in data.packages:
            package = Package.get_by_nameversion(package_info['name'],
                                                 package_info['version'])
            if not package:
                equation = package_info.get('equation', None)
                version = Version.get_by_version(package_info['version']) or\
                    Version.add(package_info['version'], equation)
                requirements = self.get_requirements(
                    package_info['requirements'], data.versionmap)
                package = Package.add(package_info['name'], version,
                                      requirements)

            packages.append(package)

        buildout = Buildout(data.name,
                            host,
                            checksum,
                            started=data.started,
                            finished=data.finished,
                            packages=packages,
                            config=data.config)

        DBSession.add(buildout)
        self.remove_old_buildouts(data.name)
        return buildout
Ejemplo n.º 2
0
    def add_buildout(self, data, host, checksum):
        packages = []

        for package_info in data.packages:
            package = Package.get_by_nameversion(package_info['name'],
                                                 package_info['version'])
            if not package:
                equation = package_info.get('equation', None)
                version = Version.get_by_version(package_info['version']) or\
                    Version.add(package_info['version'], equation)
                requirements = self.get_requirements(
                    package_info['requirements'], data.versionmap)
                package = Package.add(package_info['name'],
                                      version,
                                      requirements)

            packages.append(package)

        buildout = Buildout(data.name, host, checksum, started=data.started,
                            finished=data.finished, packages=packages,
                            config=data.config)

        DBSession.add(buildout)
        self.remove_old_buildouts(data.name)
        return buildout
Ejemplo n.º 3
0
    def get_requirements(self, requirements, versionmap):
        """Return list of package requirements."""
        packages = []

        for req in requirements:
            name = req.get('name')
            version = req.get('version')
            # Below version related code is crap
            # TODO: Clean the crap
            if not version:
                try:
                    version = versionmap[name]
                except KeyError:
                    version = 'stdlib'
            else:
                if version != versionmap[name]:
                    version = versionmap[name]
            package = Package.get_by_nameversion(name, version)
            if not package:
                equation = req.get('equation', None)
                version = Version.get_by_version(version) or\
                    Version.add(version, equation)
                package = Package.add(req['name'], version)
            packages.append(package)

        return packages
Ejemplo n.º 4
0
    def get_requirements(self, requirements, versionmap):
        """Return list of package requirements."""
        packages = []

        for req in requirements:
            name = req.get('name')
            version = req.get('version')
            # Below version related code is crap
            # TODO: Clean the crap
            if not version:
                try:
                    version = versionmap[name]
                except KeyError:
                    version = 'stdlib'
            else:
                if version != versionmap[name]:
                    version = versionmap[name]
            package = Package.get_by_nameversion(name,
                                                 version)
            if not package:
                equation = req.get('equation', None)
                version = Version.get_by_version(version) or\
                    Version.add(version, equation)
                package = Package.add(req['name'], version)
            packages.append(package)

        return packages