<commit_before>#!/usr/bin/env python
import os
import errno
import platform
import sys
import subprocess

# Figure out what type of package to build based on platform info
#
# TODO: Windows does MSI?

deb = ['debian', 'ubuntu']
rpm = ['redhat', 'fedora', 'suse', 'opensuse']

dist = platform.dist()[0].lower()


def pkg_type():
    if dist in deb:
        return "deb"

    if dist in rpm:
        return "rpm"

    return None


def pkg_dir():
    system = platform.system().lower()
    machine = platform.machine().lower()
    addon = ""
    if system == "freebsd":
        system = system + platform.release().lower()[0]
    if system == "linux":
        dist = platform.dist()
        # Lower case everyting (looking at you Ubuntu)
        dist = tuple([x.lower() for x in dist])

        # Treat all redhat 5.* versions the same
        # redhat-5.5 becomes redhat-5
        if (dist[0] == "redhat" or dist[0] == "centos"):
            major = dist[1].split(".")[0]
            dist = (dist[0], major)

        dist = "%s-%s" % dist[:2]
        return "%s-%s" % (dist, machine)

    return "%s-%s%s" % (system, machine, addon)


def sh(cmd):
    print cmd
    rv = subprocess.call(cmd, shell=True)
    if rv != 0:
        print "Exit Code: %s" % (rv)<commit_msg>tools: pkgutils: workaround centos bug<commit_after>#!/usr/bin/env python
import os
import errno
import platform
import sys
import subprocess

# Figure out what type of package to build based on platform info
#
# TODO: Windows does MSI?

deb = ['debian', 'ubuntu']
rpm = ['redhat', 'fedora', 'suse', 'opensuse', 'centos']

dist = platform.dist()[0].lower()


def pkg_type():
    if dist in deb:
        return "deb"

    if dist in rpm:
        return "rpm"

    return None


def pkg_dir():
    system = platform.system().lower()
    machine = platform.machine().lower()
    addon = ""
    if system == "freebsd":
        system = system + platform.release().lower()[0]
    if system == "linux":
        dist = platform.dist()
        # Lower case everyting (looking at you Ubuntu)
        dist = tuple([x.lower() for x in dist])

        # Treat all redhat 5.* versions the same
        # redhat-5.5 becomes redhat-5
        if (dist[0] == "redhat" or dist[0] == "centos"):
            major = dist[1].split(".")[0]
            distro = dist[0]

            # http://bugs.centos.org/view.php?id=5197
            # CentOS 5.7 identifies as redhat
            if int(major) <= 5 and distro == "redhat":
                f = open('/etc/redhat-release')
                new_dist = f.read().lower().split(" ")[0]
                if new_dist == "centos":
                    distro = "centos"

            dist = (distro, major)

        dist = "%s-%s" % dist[:2]
        return "%s-%s" % (dist, machine)

    return "%s-%s%s" % (system, machine, addon)


def sh(cmd):
    print cmd
    rv = subprocess.call(cmd, shell=True)
    if rv != 0:
        print "Exit Code: %s" % (rv)
{'fraction_non_alphanumeric': 0.15277305205852332, 'fraction_numerical': 0.011568560734943858, 'mean_word_length': 2.252212389380531, 'pattern_counts': {'":': 6, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5786425', 'n_tokens_mistral': 995, 'n_tokens_neox': 929, 'n_words': 294}