<commit_before>import re
import os
import sys
import subprocess
import zipfile
import urllib2

from distutils.dir_util import copy_tree


PYTHON_VERSION = "%s.%s" % (sys.version_info[0],
                            sys.version_info[1])
CACHE_PATH = "download_cache"


if not os.path.isdir(CACHE_PATH):
    os.makedirs(CACHE_PATH)


def download_file(link, name, type):
    filepath_path = os.path.join(CACHE_PATH,"%s.%s" % (name,type))
    fp = open(filepath_path, 'wb')
    downloaded = 0
    print link
    resp = urllib2.urlopen(link)
    total_length = None
    try:
        if resp.info().getheaders("Content-Length"):
            total_length = int(resp.info().getheaders("Content-Length")[0])
            print('Downloading %s (%s kB): ' % (link, total_length/1024))
        else:
            print('Downloading %s (unknown size): ' % link)
        while True:
            chunk = resp.read(4096)
            if not chunk:
                break
            downloaded += len(chunk)
            if not total_length:
                sys.stdout.write('\r%s kB' % (downloaded/1024))
            else:
                sys.stdout.write('\r%3i%%  %s kB' % (100*downloaded/total_length, downloaded/1024))
            sys.stdout.flush()
            fp.write(chunk)
    finally:
        fp.close()
        sys.stdout.write('\n');
        sys.stdout.flush()
    return filepath_path


def get_apt_packages():
    package_names = re.split('\s+', '''git python-dev python-pip
        python-pyparsing ipython scons python-gtk2 python libboost-all-dev
        python-matplotlib python-numpy python-scipy python-jinja2 avrdude''')
    return [(name, 'apt') for name in package_names]


def get_pip_packages():
    implicit = [("pyparsing", "pip"),
            ("pyutilib.component.core", "pip"),
            ("pyutilib.component.loader", "pip"),
            ("blinker", "pip"),
            ("configobj", "pip"),
            ("yaml", "pip", "pyyaml"),
            ("nose", "pip"),
            ("pathmunge", "pip", "nose-pathmunge"),
            ("IPython", "pip", "ipython"),
            ("sphinx", "pip"), ]

    explicit = [("pylint", "pip", "http://download.logilab.org/pub/pylint/pylint-0.25.1.tar.gz"),
            ("constraint", "pip", "https://github.com/cfobel/python___labix_constraint/tarball/master"),
            ("jsonrpc", "pip", "https://github.com/cfobel/python-jsonrpc/tarball/master"),
            ("pymunk", "pip", "https://github.com/cfobel/python___pymunk/tarball/chipmunk-6.0.2"),
            ("path", "pip", "http://microfluidics.utoronto.ca/git/path.py.git/snapshot/da43890764f1ee508fe6c32582acd69b87240365.zip"),
    ]

    force = [("pygtkhelpers", "pip", "https://github.com/cfobel/pygtkhelpers/"\
            "tarball/pre_object_tree"), <commit_msg>Add missing dependencies to linux_install_dependencies.py<commit_after>import re
import os
import sys
import subprocess
import zipfile
import urllib2

from distutils.dir_util import copy_tree


PYTHON_VERSION = "%s.%s" % (sys.version_info[0],
                            sys.version_info[1])
CACHE_PATH = "download_cache"


if not os.path.isdir(CACHE_PATH):
    os.makedirs(CACHE_PATH)


def download_file(link, name, type):
    filepath_path = os.path.join(CACHE_PATH,"%s.%s" % (name,type))
    fp = open(filepath_path, 'wb')
    downloaded = 0
    print link
    resp = urllib2.urlopen(link)
    total_length = None
    try:
        if resp.info().getheaders("Content-Length"):
            total_length = int(resp.info().getheaders("Content-Length")[0])
            print('Downloading %s (%s kB): ' % (link, total_length/1024))
        else:
            print('Downloading %s (unknown size): ' % link)
        while True:
            chunk = resp.read(4096)
            if not chunk:
                break
            downloaded += len(chunk)
            if not total_length:
                sys.stdout.write('\r%s kB' % (downloaded/1024))
            else:
                sys.stdout.write('\r%3i%%  %s kB' % (100*downloaded/total_length, downloaded/1024))
            sys.stdout.flush()
            fp.write(chunk)
    finally:
        fp.close()
        sys.stdout.write('\n');
        sys.stdout.flush()
    return filepath_path


def get_apt_packages():
    package_names = re.split('\s+', '''git python-dev python-pip
        python-pyparsing ipython scons python-gtk2 python libboost-all-dev
        python-matplotlib python-numpy python-scipy python-jinja2 avrdude
        gcc-avr avr-libc python-lxml python-opencv''')
    return [(name, 'apt') for name in package_names]


def get_pip_packages():
    implicit = [("pyparsing", "pip"),
            ("pyutilib.component.core", "pip"),
            ("pyutilib.component.loader", "pip"),
            ("blinker", "pip"),
            ("configobj", "pip"),
            ("yaml", "pip", "pyyaml"),
            ("nose", "pip"),
            ("pathmunge", "pip", "nose-pathmunge"),
            ("IPython", "pip", "ipython"),
            ("sphinx", "pip"), ]

    explicit = [("pylint", "pip", "http://download.logilab.org/pub/pylint/pylint-0.25.1.tar.gz"),
            ("constraint", "pip", "https://github.com/cfobel/python___labix_constraint/tarball/master"),
            ("jsonrpc", "pip", "https://github.com/cfobel/python-jsonrpc/tarball/master"),
            ("pymunk", "pip", "https://github.com/cfobel/python___pymunk/tarball/chipmunk-6.0.2"),
            ("path", "pip", "http://microfluidics.utoronto.ca/git/path.py.git/snapshot/da43890764f1ee508fe6c32582acd69b87240365.zip"),
    ]

    force = [("pygtkhelpers", "pip", "https://github.com/cfobel/pygtkhelpers/"\
            "tarball/pre_object_tree"), 
{'fraction_non_alphanumeric': 0.15965192683359972, 'fraction_numerical': 0.022376132125732553, 'mean_word_length': 2.4594594594594597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '944248', 'n_tokens_mistral': 1989, 'n_tokens_neox': 1864, 'n_words': 334}