Exemplo n.º 1
0
def main():
    print("Querying openSUSE build service status of Nuitka packages.")

    osc_cmd = ["osc", "pr", "-c", "home:kayhayen"]

    stdout_osc = check_output(args=osc_cmd)

    # Response is really a CSV file, so use that for parsing.
    csvfile = StringIO(stdout_osc)
    osc_reader = csv.reader(csvfile, delimiter=";")

    osc_reader = iter(osc_reader)

    bad = ("failed", "unresolvable", "broken", "blocked")

    titles = osc_reader.next()[1:]

    # Nuitka (follow git master branch)
    row1 = osc_reader.next()
    # Nuitka-Unstable (follow git develop branch)
    row2 = osc_reader.next()

    problems = []

    def decideConsideration(title):
        # Ignore other arch builds, they might to not even boot at times.
        if "ppc" in title or "aarch" in title or "arm" in title:
            return False

        # This fails for other reasons often, and is not critical to Nuitka.
        if "openSUSE_Tumbleweed" in title:
            return False

        return True

    for count, title in enumerate(titles):
        if not decideConsideration(title):
            continue

        status = row1[count + 1]

        if status in bad:
            problems.append((row1[0], title, status))

    for count, title in enumerate(titles):
        if not decideConsideration(title):
            continue

        status = row2[count + 1]

        if status in bad:
            problems.append((row2[0], title, status))

    if problems:
        print("There are problems with:")
        print("\n".join("%s: %s (%s)" % problem for problem in problems))

        sys.exit(1)
    else:
        print("Looks good.")
        sys.exit(0)
Exemplo n.º 2
0
    def _packagePmw2(self, srcdir, version):
        def mungeFile(filename):
            # Read the filename and modify it so that it can be bundled with the
            # other Pmw files.
            filename = "Pmw" + filename + ".py"
            with open(os.path.join(srcdir, filename)) as f:
                text = f.read()
            text = re.sub(r"import Pmw\>", "", text)
            text = re.sub("INITOPT = Pmw.INITOPT", "", text)
            text = re.sub(r"\<Pmw\.", "", text)
            text = "\n" + ("#" *
                           70) + "\n" + "### File: " + filename + "\n" + text
            return text

        # Code to import the Color module.
        colorCode = """
import PmwColor
Color = PmwColor
del PmwColor
"""
        # Code to import the Blt module.
        bltCode = """
import PmwBlt
Blt = PmwBlt
del PmwBlt
"""
        # Code used when not linking with PmwBlt.py.
        ignoreBltCode = """
_bltImported = 1
_bltbusyOK = 0
"""
        # Code to define the functions normally supplied by the dynamic loader.
        extraCode = """

### Loader functions:

_VERSION = '%s'

def setversion(version):
    if version != _VERSION:
        raise ValueError, 'Dynamic versioning not available'

def setalphaversions(*alpha_versions):
    if alpha_versions != ():
        raise ValueError, 'Dynamic versioning not available'

def version(alpha = 0):
    if alpha:
        return ()
    else:
        return _VERSION

def installedversions(alpha = 0):
    if alpha:
        return ()
    else:
        return (_VERSION,)

"""

        # Set this to 0 if you do not use any of the Pmw.Color functions:
        # Set this to 0 if you do not use any of the Pmw.Blt functions:
        needBlt = not self.getPluginOptionBool("blt", True)
        needColor = not self.getPluginOptionBool("color", True)

        outfile = StringIO()

        if needColor:
            outfile.write(colorCode)

        if needBlt:
            outfile.write(bltCode)

        outfile.write(extraCode % version)

        # Specially handle PmwBase.py filename:
        text = mungeFile("Base")
        text = re.sub("import PmwLogicalFont", "", text)
        text = re.sub("PmwLogicalFont._font_initialise", "_font_initialise",
                      text)
        outfile.write(text)
        if not needBlt:
            outfile.write(ignoreBltCode)

        files.append("LogicalFont")

        for filename in files:
            text = mungeFile(filename)
            outfile.write(text)

        return outfile.getvalue()
Exemplo n.º 3
0
def main():
    print("Querying openSUSE build service status of Nuitka packages.")

    osc_cmd = ["osc", "pr", "-c", "home:kayhayen"]

    process = subprocess.Popen(args=osc_cmd,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)

    stdout_osc, stderr_osc = process.communicate()
    exit_osc = process.returncode

    assert exit_osc == 0, stderr_osc

    # print(stdout_osc)

    csvfile = StringIO(stdout_osc)
    osc_reader = csv.reader(csvfile, delimiter=';')

    osc_reader = iter(osc_reader)

    bad = ("failed", "unresolvable", "broken", "blocked", "disabled")

    titles = osc_reader.next()[1:]

    # Nuitka (follow git master branch)
    row1 = osc_reader.next()
    # Nuitka-Unstable (follow git develop branch)
    row2 = osc_reader.next()

    problems = []

    for count, title in enumerate(titles):
        status = row1[count + 1]

        # print(row1[0], title, ":", status)
        # Ignore PowerPC builds for now, they seem to not even boot.
        if "ppc" in title:
            continue

        if status in bad:
            problems.append((row1[0], title, status))

    for count, title in enumerate(titles):
        status = row2[count + 1]

        # print(row2[0], title, ":", status)
        # Ignore PowerPC builds for now, they seem to not even boot.
        if "ppc" in title:
            continue

        if status in bad:
            problems.append((row2[0], title, status))

    if problems:
        print("There are problems with:")
        print('\n'.join("%s: %s (%s)" % problem for problem in problems))

        sys.exit(1)
    else:
        print("Looks good.")
        sys.exit(0)
Exemplo n.º 4
0
    def _packagePmw2(self, srcdir, version):
        def mungeFile(filename):
            # Read the filename and modify it so that it can be bundled with the
            # other Pmw files.
            filename = "Pmw" + filename + ".py"
            text = open(os.path.join(srcdir, filename)).read()
            text = re.sub(r"import Pmw\>", "", text)
            text = re.sub("INITOPT = Pmw.INITOPT", "", text)
            text = re.sub(r"\<Pmw\.", "", text)
            text = '\n' + ('#' * 70) + '\n' + "### File: " + filename + '\n' + text
            return text

        # Code to import the Color module.
        colorCode = """
import PmwColor
Color = PmwColor
del PmwColor
"""
        # Code to import the Blt module.
        bltCode = """
import PmwBlt
Blt = PmwBlt
del PmwBlt
"""
        # Code used when not linking with PmwBlt.py.
        ignoreBltCode = """
_bltImported = 1
_bltbusyOK = 0
"""
        # Code to define the functions normally supplied by the dynamic loader.
        extraCode = """

### Loader functions:

_VERSION = '%s'

def setversion(version):
    if version != _VERSION:
        raise ValueError, 'Dynamic versioning not available'

def setalphaversions(*alpha_versions):
    if alpha_versions != ():
        raise ValueError, 'Dynamic versioning not available'

def version(alpha = 0):
    if alpha:
        return ()
    else:
        return _VERSION

def installedversions(alpha = 0):
    if alpha:
        return ()
    else:
        return (_VERSION,)

"""

        # Set this to 0 if you do not use any of the Pmw.Color functions:
        # Set this to 0 if you do not use any of the Pmw.Blt functions:
        needBlt = not self.getPluginOptionBool("noblt", True)
        needColor = not self.getPluginOptionBool("nocolor", True)

        outfile = StringIO()

        if needColor:
            outfile.write(colorCode)

        if needBlt:
            outfile.write(bltCode)

        outfile.write(extraCode % version)

        # Specially handle PmwBase.py filename:
        text = mungeFile("Base")
        text = re.sub("import PmwLogicalFont", "", text)
        text = re.sub("PmwLogicalFont._font_initialise", "_font_initialise", text)
        outfile.write(text)
        if not needBlt:
            outfile.write(ignoreBltCode)

        files.append("LogicalFont")

        for filename in files:
            text = mungeFile(filename)
            outfile.write(text)

        return outfile.getvalue()
Exemplo n.º 5
0
def fromString(text):
    return xml_module.parse(StringIO(text)).getroot()
Exemplo n.º 6
0
def main():
    my_print("Querying openSUSE build service status of Nuitka packages.")

    osc_cmd = ["osc", "pr", "-c", "home:kayhayen"]

    stdout_osc = check_output(args=osc_cmd)

    if str is not bytes:
        stdout_osc = stdout_osc.decode("utf8")

    # Response is really a CSV file, so use that for parsing.
    csvfile = StringIO(stdout_osc)
    osc_reader = csv.reader(csvfile, delimiter=";")

    osc_reader = iter(osc_reader)

    bad = ("failed", "unresolvable", "broken", "blocked")

    titles = next(osc_reader)[1:]

    # Nuitka (follow git main branch)
    row1 = next(osc_reader)
    # Nuitka-Unstable (follow git develop branch)
    row2 = next(osc_reader)
    # Nuitka-Experimental (follow git factory branch)
    row3 = next(osc_reader)

    problems = []

    def decideConsideration(title, status):
        # Ignore other arch builds, they might to not even boot at times.
        if "ppc" in title or "aarch" in title or "arm" in title:
            return False

        # This fails for other reasons often, and is not critical to Nuitka.
        if "openSUSE_Tumbleweed" in title:
            return False

        # Ignore old Fedora and RHEL6 32 bit being blocked.
        if status == "blocked":
            if ("Fedora_2" in title or "RedHat_RHEL-6/i586" in title
                    or "CentOS_CentOS-6/i586" in title):
                return False

        # It makes building visible now, that's not an error of course.
        if status == "building":
            return False

        return True

    for count, title in enumerate(titles):
        status = row1[count + 1]

        if not decideConsideration(title, status):
            continue

        if status in bad:
            problems.append((row1[0], title, status))

    for count, title in enumerate(titles):
        status = row2[count + 1]

        if not decideConsideration(title, status):
            continue

        if status in bad:
            problems.append((row2[0], title, status))

    for count, title in enumerate(titles):
        status = row3[count + 1]

        if not decideConsideration(title, status):
            continue

        if status in bad:
            problems.append((row3[0], title, status))

    if problems:
        my_print("There are problems with:", style="yellow")
        my_print("\n".join("%s: %s (%s)" % problem for problem in problems),
                 style="yellow")

        sys.exit(1)
    else:
        my_print("Looks good.", style="blue")
        sys.exit(0)