<commit_before>import os


class MonoMasterEncryptedPackage(Package):

    def __init__(self):
	if os.getenv('MONO_VERSION') is None:
		raise Exception('You must export MONO_VERSION to use this build profile. e.g. export MONO_VERSION=3.1.0')

        Package.__init__(self, 'mono', os.getenv('MONO_VERSION'),
                         sources=[
                             'git://github.com/mono/mono.git',
                             '<EMAIL>:xamarin/mono-extensions.git'],
                         revision=os.getenv('MONO_BUILD_REVISION'),
                         configure_flags=[
                             '--enable-nls=no',
                             '--prefix=' + Package.profile.prefix,
                             '--with-ikvm=yes',
                             '--with-moonlight=no'
                         ])

        if Package.profile.name == 'darwin':
            self.configure_flags.extend([
                # fix build on lion, it uses 64-bit host even with -m32
                '--build=i386-apple-darwin11.2.0',
                '--enable-loadedllvm'
            ])

            if os.getenv('MONO_BRANCH') == 'master':
                self.configure_flags.extend(['--enable-extension-module=crypto,native-types'])

        self.sources.extend([
            # Fixes up pkg-config usage on the Mac
            'patches/mcs-pkgconfig.patch'
        ])

        self.configure = 'CFLAGS=-O2 ./autogen.sh'
        self.make = 'make'

    def checkout_mono_extensions(self, build_root):
        ext = self.sources[1]
        dirname = os.path.join(build_root, "mono-extensions")
        if not os.path.exists(dirname):
            self.sh('%' + '{git} clone --local --shared "%s" "%s"' % (ext, dirname))
        self.cd(dirname)
        self.sh('%{git} clean -xfd')
        self.sh('%{git} pull')


    def apply_crypto(self):
        # Copied from Package#prep, makes sure we get the latest
        # extensions
        build_root = os.path.abspath(os.path.join(os.getcwd(), ".."))
        self.checkout_mono_extensions(build_root)

        # Use quilt to apply the patch queue
        self.cd(build_root)
        mono = os.path.join(build_root, "mono")
        full_mono = os.path.join(build_root, self.name + "-" + self.version)
        full_mono_extensions = os.path.join(build_root, "mono-extensions")

        if not os.path.exists(mono):
            os.symlink(full_mono, mono)
        else:
            mono_link = os.path.join(os.path.dirname(mono), os.readlink(mono))
            if not (mono_link == full_mono):
                os.remove(mono)<commit_msg>Expand cflags when calling mono's configure so it picks options such -mmacosx-version-min.<commit_after>import os


class MonoMasterEncryptedPackage(Package):

    def __init__(self):
	if os.getenv('MONO_VERSION') is None:
		raise Exception('You must export MONO_VERSION to use this build profile. e.g. export MONO_VERSION=3.1.0')

        Package.__init__(self, 'mono', os.getenv('MONO_VERSION'),
                         sources=[
                             'git://github.com/mono/mono.git',
                             'git<EMAIL>:xamarin/mono-extensions.git'],
                         revision=os.getenv('MONO_BUILD_REVISION'),
                         configure_flags=[
                             '--enable-nls=no',
                             '--prefix=' + Package.profile.prefix,
                             '--with-ikvm=yes',
                             '--with-moonlight=no'
                         ])

        if Package.profile.name == 'darwin':
            self.configure_flags.extend([
                # fix build on lion, it uses 64-bit host even with -m32
                '--build=i386-apple-darwin11.2.0',
                '--enable-loadedllvm'
            ])

            if os.getenv('MONO_BRANCH') == 'master':
                self.configure_flags.extend(['--enable-extension-module=crypto,native-types'])

        self.sources.extend([
            # Fixes up pkg-config usage on the Mac
            'patches/mcs-pkgconfig.patch'
        ])

        self.configure = expand_macros ('CFLAGS="%{env.CFLAGS} -O2" ./autogen.sh', Package.profile)
        self.make = 'make'

    def checkout_mono_extensions(self, build_root):
        ext = self.sources[1]
        dirname = os.path.join(build_root, "mono-extensions")
        if not os.path.exists(dirname):
            self.sh('%' + '{git} clone --local --shared "%s" "%s"' % (ext, dirname))
        self.cd(dirname)
        self.sh('%{git} clean -xfd')
        self.sh('%{git} pull')


    def apply_crypto(self):
        # Copied from Package#prep, makes sure we get the latest
        # extensions
        build_root = os.path.abspath(os.path.join(os.getcwd(), ".."))
        self.checkout_mono_extensions(build_root)

        # Use quilt to apply the patch queue
        self.cd(build_root)
        mono = os.path.join(build_root, "mono")
        full_mono = os.path.join(build_root, self.name + "-" + self.version)
        full_mono_extensions = os.path.join(build_root, "mono-extensions")

        if not os.path.exists(mono):
            os.symlink(full_mono, mono)
        else:
            mono_link = os.path.join(os.path.dirname(mono), os.readlink(mono))
            if not (mono_link == full_mono):
                os.remove(mono)
{'fraction_non_alphanumeric': 0.13138548539114042, 'fraction_numerical': 0.006032045240339303, 'mean_word_length': 1.753502854177478, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '106661', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1588, 'n_words': 301}