def _getParts(self, partIncludes, partsCfg, script):
        self._console.debug("Creating part structures...")

        self._console.indent()
        parts = {}
        for partPos, partId in enumerate(partIncludes):
            npart = Part(partId)  # create new Part object
            npart.bit_mask = script.getPartBitMask()  # add unique bit
            initial_deps = list(
                set(partIncludes[partId]).difference(script.excludes)
            )  # defining classes from config minus expanded excludes
            npart.initial_deps = initial_deps  # for later cross-part checking
            npart.deps = initial_deps[:]  # own copy, as this will get expanded
            if 'expected-load-order' in partsCfg[partId]:
                npart.collapse_index = partsCfg[partId]['expected-load-order']
            if 'no-merge-private-package' in partsCfg[partId]:
                npart.no_merge_private_package = partsCfg[partId][
                    'no-merge-private-package']
            parts[partId] = npart
            self._console.debug("Part #%s => %s" % (partId, npart.bit_mask))

        self._console.outdent()

        return parts
示例#2
0
    def _getParts(self, partIncludes, partsCfg, script):
        self._console.debug("Creating part structures...")

        self._console.indent()
        parts = {}
        for partPos, partId in enumerate(partIncludes):
            npart = Part(partId)    # create new Part object
            npart.bit_mask = script.getPartBitMask()      # add unique bit
            initial_deps = list(set(partIncludes[partId]).difference(script.excludes)) # defining classes from config minus expanded excludes
            npart.initial_deps = initial_deps    # for later cross-part checking
            npart.deps = initial_deps[:] # own copy, as this will get expanded
            if 'expected-load-order' in partsCfg[partId]:
                npart.collapse_index = partsCfg[partId]['expected-load-order']
            if 'no-merge-private-package' in partsCfg[partId]:
                npart.no_merge_private_package = partsCfg[partId]['no-merge-private-package']
            parts[partId] = npart
            self._console.debug("Part #%s => %s" % (partId, npart.bit_mask))

        self._console.outdent()

        return parts
示例#3
0
        def partsConfigFromClassList(includeWithDeps, excludeWithDeps, script):

            def evalPackagesConfig(excludeWithDeps, classList, variants):

                # Reading configuration
                partsCfg = self._job.get("packages/parts", {})

                # Expanding expressions
                self._console.debug("Expanding include expressions...")
                partIncludes = {}
                for partId in partsCfg:
                    partIncludes[partId] = textutil.expandGlobs(partsCfg[partId]['include'], self._classesObj)

                # Computing packages
                #boot, partPackages, packageClasses = self._partBuilder.getPackages(partIncludes, excludeWithDeps, self._context, script)
                partPackages, _ = self._partBuilder.getPackages(partIncludes, excludeWithDeps, self._context, script)
                packageClasses = script.packagesSorted()

                #return boot, partPackages, packageClasses
                return script.boot, script.parts, packageClasses


            # -----------------------------------------------------------
            classList = script.classes
            variants = script.variants
            self._partBuilder = PartBuilder(self._console, self._depLoader)

            # Check for a 'packages' configuration in the job
            if 0:
                # this branch should work, but doesn't;
                # create a synthetic job key and let evalPackagesConfig do the rest
                if not self._job.get("packages"):
                    package_config = {
                        "parts" : {
                            "boot" : {
                                "include" : includeWithDeps
                            }
                        },
                        "init" : "boot"
                    }
                    self._job.setFeature("packages", package_config)
                (boot,
                partPackages,           # partPackages[partId]=[0,1,3]
                packageClasses          # packageClasses[0]=['qx.Class','qx.bom.Stylesheet',...]
                ) = evalPackagesConfig(excludeWithDeps, classList, variants)
            else:
                if self._job.get("packages"):
                    (boot,
                    partPackages,           # partPackages[partId]=[0,1,3]
                    packageClasses          # packageClasses[0]=['qx.Class','qx.bom.Stylesheet',...]
                    ) = evalPackagesConfig(excludeWithDeps, classList, variants)
                else:
                    # Emulate a 'boot' part
                    boot = "boot"
                    partPackages = { "boot" : [0] }
                    packageClasses = [classList]
                    # patch script object
                    script.boot = boot
                    packageObj = Package(0)
                    packageObj.classes = script.classesObj
                    script.packages.append(packageObj)
                    partObj = Part("boot")
                    partObj.packages.append(packageObj)
                    initial_deps = list(set(includeWithDeps).difference(script.excludes)) # defining classes from config minus expanded excludes
                    partObj.initial_deps = initial_deps
                    partObj.deps = initial_deps[:]
                    script.parts = { "boot" : partObj }

            return boot, partPackages, packageClasses
示例#4
0
        def partsConfigFromClassList(includeWithDeps, excludeWithDeps, script):

            def evalPackagesConfig(excludeWithDeps, classList, variants):

                # Reading configuration
                partsCfg = self._job.get("packages/parts", {})

                # Expanding expressions
                self._console.debug("Expanding include expressions...")
                partIncludes = {}
                for partId in partsCfg:
                    partIncludes[partId] = textutil.expandGlobs(partsCfg[partId]['include'], self._classesObj)

                # Computing packages
                #boot, partPackages, packageClasses = self._partBuilder.getPackages(partIncludes, excludeWithDeps, self._context, script)
                partPackages, _ = self._partBuilder.getPackages(partIncludes, excludeWithDeps, self._context, script)
                packageClasses = script.packagesSorted()

                #return boot, partPackages, packageClasses
                return script.boot, script.parts, packageClasses


            # -----------------------------------------------------------
            classList = script.classes
            variants = script.variants
            self._partBuilder = PartBuilder(self._console, self._depLoader)

            # Use the 'packages' configuration in the job or fake it dynamically.

            # Using a synthetic config object and running evalPackagesConfig()
            # in any case doesn't pay off, because the Generator then prints
            # out messages regarding parts which irritates the user and assumes
            # that includeWithDeps is used (and fails with includeNoDeps).
            if self._job.get("packages"):
                (boot,
                partPackages,           # partPackages[partId]=[0,1,3]
                packageClasses          # packageClasses[0]=['qx.Class','qx.bom.Stylesheet',...]
                ) = evalPackagesConfig(excludeWithDeps, classList, variants)
            else:
                # bug#7667: Tried to consolidate with if body above, but the
                # codebase needs too many adaptions to be also compatible with
                # includeNoDeps (e.g. "=myClass" in config). Therefore this
                # code branch is kept: Instead of computing the deps, the
                # classes from script.classesObj are used.

                # Emulate a 'boot' part
                boot = "boot"
                partPackages = { "boot" : [0] }
                packageClasses = [classList]
                # patch script object
                script.boot = boot
                packageObj = Package(0)
                packageObj.classes = script.classesObj
                script.packages.append(packageObj)
                partObj = Part("boot")
                partObj.packages.append(packageObj)
                initial_deps = list(set(includeWithDeps).difference(script.excludes)) # defining classes from config minus expanded excludes
                partObj.initial_deps = initial_deps
                partObj.deps = initial_deps[:]
                script.parts = { "boot" : partObj }

            return boot, partPackages, packageClasses
示例#5
0
        def partsConfigFromClassList(includeWithDeps, excludeWithDeps, script):
            def evalPackagesConfig(excludeWithDeps, classList, variants):

                # Reading configuration
                partsCfg = self._job.get("packages/parts", {})

                # Expanding expressions
                self._console.debug("Expanding include expressions...")
                partIncludes = {}
                for partId in partsCfg:
                    partIncludes[partId] = textutil.expandGlobs(
                        partsCfg[partId]['include'], self._classesObj)

                # Computing packages
                #boot, partPackages, packageClasses = self._partBuilder.getPackages(partIncludes, excludeWithDeps, self._context, script)
                partPackages, _ = self._partBuilder.getPackages(
                    partIncludes, excludeWithDeps, self._context, script)
                packageClasses = script.packagesSorted()

                #return boot, partPackages, packageClasses
                return script.boot, script.parts, packageClasses

            # -----------------------------------------------------------
            classList = script.classes
            variants = script.variants
            self._partBuilder = PartBuilder(self._console, self._depLoader)

            # Check for a 'packages' configuration in the job
            if 0:
                # this branch should work, but doesn't;
                # create a synthetic job key and let evalPackagesConfig do the rest
                if not self._job.get("packages"):
                    package_config = {
                        "parts": {
                            "boot": {
                                "include": includeWithDeps
                            }
                        },
                        "init": "boot"
                    }
                    self._job.setFeature("packages", package_config)
                (
                    boot,
                    partPackages,  # partPackages[partId]=[0,1,3]
                    packageClasses  # packageClasses[0]=['qx.Class','qx.bom.Stylesheet',...]
                ) = evalPackagesConfig(excludeWithDeps, classList, variants)
            else:
                if self._job.get("packages"):
                    (
                        boot,
                        partPackages,  # partPackages[partId]=[0,1,3]
                        packageClasses  # packageClasses[0]=['qx.Class','qx.bom.Stylesheet',...]
                    ) = evalPackagesConfig(excludeWithDeps, classList,
                                           variants)
                else:
                    # Emulate a 'boot' part
                    boot = "boot"
                    partPackages = {"boot": [0]}
                    packageClasses = [classList]
                    # patch script object
                    script.boot = boot
                    packageObj = Package(0)
                    packageObj.classes = script.classesObj
                    script.packages.append(packageObj)
                    partObj = Part("boot")
                    partObj.packages.append(packageObj)
                    initial_deps = list(
                        set(includeWithDeps).difference(script.excludes)
                    )  # defining classes from config minus expanded excludes
                    partObj.initial_deps = initial_deps
                    partObj.deps = initial_deps[:]
                    script.parts = {"boot": partObj}

            return boot, partPackages, packageClasses
示例#6
0
        def partsConfigFromClassList(includeWithDeps, excludeWithDeps, script):
            def evalPackagesConfig(excludeWithDeps, classList, variants):

                # Reading configuration
                partsCfg = self._job.get("packages/parts", {})

                # Expanding expressions
                self._console.debug("Expanding include expressions...")
                partIncludes = {}
                for partId in partsCfg:
                    partIncludes[partId] = textutil.expandGlobs(
                        partsCfg[partId]['include'], self._classesObj)

                # Computing packages
                #boot, partPackages, packageClasses = self._partBuilder.getPackages(partIncludes, excludeWithDeps, self._context, script)
                partPackages, _ = self._partBuilder.getPackages(
                    partIncludes, excludeWithDeps, self._context, script)
                packageClasses = script.packagesSorted()

                #return boot, partPackages, packageClasses
                return script.boot, script.parts, packageClasses

            # -----------------------------------------------------------
            classList = script.classes
            variants = script.variants
            self._partBuilder = PartBuilder(self._console, self._depLoader)

            # Use the 'packages' configuration in the job or fake it dynamically.

            # Using a synthetic config object and running evalPackagesConfig()
            # in any case doesn't pay off, because the Generator then prints
            # out messages regarding parts which irritates the user and assumes
            # that includeWithDeps is used (and fails with includeNoDeps).
            if self._job.get("packages"):
                (
                    boot,
                    partPackages,  # partPackages[partId]=[0,1,3]
                    packageClasses  # packageClasses[0]=['qx.Class','qx.bom.Stylesheet',...]
                ) = evalPackagesConfig(excludeWithDeps, classList, variants)
            else:
                # bug#7667: Tried to consolidate with if body above, but the
                # codebase needs too many adaptions to be also compatible with
                # includeNoDeps (e.g. "=myClass" in config). Therefore this
                # code branch is kept: Instead of computing the deps, the
                # classes from script.classesObj are used.

                # Emulate a 'boot' part
                boot = "boot"
                partPackages = {"boot": [0]}
                packageClasses = [classList]
                # patch script object
                script.boot = boot
                packageObj = Package(0)
                packageObj.classes = script.classesObj
                script.packages.append(packageObj)
                partObj = Part("boot")
                partObj.packages.append(packageObj)
                initial_deps = list(
                    set(includeWithDeps).difference(script.excludes)
                )  # defining classes from config minus expanded excludes
                partObj.initial_deps = initial_deps
                partObj.deps = initial_deps[:]
                script.parts = {"boot": partObj}

            return boot, partPackages, packageClasses