<commit_before>#!/usr/bin/env python
import os, sys

def install():
    build_darling = False
    target = '/usr/share/zohmg'

    # check for rootness.
    if os.geteuid() != 0:
        print "you need to be root. please sudo."
        return
    print "installing!"

    # mkdir.
    create_share_dir(target)

    # darling.
    if build_darling:
        build_darling(target)
    else:
        copy_bundled_darling(target)

    # thrift & hbase
    copy_bundled_thrift(target)
    copy_bunded_hbase(target)


def setup():
    print
    print "installing zohmg: python setup.py install"
    r = os.system('python setup.py install > tmp/zohmg-install.log')
    if r != 0:
        print "errors?!"
        print "try again, it could work the second (or third) time."
        sys.exit(r)
    os.system("egrep '(Installing|Copying) zohmg' tmp/zohmg-install.log")

def create_share_dir(dir):
    if not os.path.exists(dir):
        os.system('mkdir ' + dir)

# not used atm; user would have to specify classpath == jobbigt.
def build_darling(target):<commit_msg>refuses to install without root powers and cleans up the mess setup tools leaves.<commit_after>#!/usr/bin/env python
import os, sys

def install():
    build_darling = False
    target = '/usr/share/zohmg'

    # check for rootness.
    if os.geteuid() != 0:
        print "you need to be root. please sudo."
        sys.exit(1)
    print "installing!"

    # mkdir.
    create_share_dir(target)

    # darling.
    if build_darling:
        build_darling(target)
    else:
        copy_bundled_darling(target)

    # thrift & hbase
    copy_bundled_thrift(target)
    copy_bunded_hbase(target)


def setup():
    print
    print "installing zohmg: python setup.py install"
    r = os.system('python setup.py install > tmp/zohmg-install.log')
    if r != 0:
        print "errors?!"
        print "try again, it could work the second (or third) time."
        sys.exit(r)
    os.system("egrep '(Installing|Copying) zohmg' tmp/zohmg-install.log")
    # clean up.
    os.system("rm -rf build dist zohmg.egg-info")

def create_share_dir(dir):
    if not os.path.exists(dir):
        os.system('mkdir ' + dir)

# not used atm; user would have to specify classpath == jobbigt.
def build_darling(target):
{'fraction_non_alphanumeric': 0.11342490031014621, 'fraction_numerical': 0.002215330084182543, 'mean_word_length': 2.7199341021416803, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5160277', 'n_tokens_mistral': 779, 'n_tokens_neox': 758, 'n_words': 207}