<commit_before>"""setuptools.command.bdist_egg

Build .egg distributions"""

# This module should be kept compatible with Python 2.3
import sys, os, marshal, re
from setuptools import Command
from distutils.dir_util import remove_tree, mkpath
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
from distutils.errors import DistutilsSetupError
from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint
from types import CodeType
from setuptools.extension import Library


def strip_module(filename):
    if '.' in filename:
        filename = os.path.splitext(filename)[0]
    if filename.endswith('module'):
        filename = filename[:-6]
    return filename


def write_spec_depend(egg_info):
    """
    egg_info is the path to the EGG-INFO directory
    """
    from enstaller.indexed_repo.metadata import data_from_spec

    pkg_info = open(os.path.join(egg_info, 'PKG-INFO')).read()

    spec = {'build': 1, 'arch':None, 'platform':None, 'osdist':None,
            'python': '%i.%i' % sys.version_info[:2],
            'packages': []
            }
    for var in ['name', 'version']:
        pat = re.compile(r'^%s:\s*(\S+)' % var, re.M | re.I)
        spec[var] = pat.search(pkg_info).group(1)

    requires_txt = os.path.join(egg_info, 'requires.txt')
    pat = re.compile(r'[\w\-.]+')
    if os.path.isfile(requires_txt):
        for line in open(requires_txt):
            m = pat.match(line.strip())
            if m:
                spec['packages'].append(m.group())

    spec_dir = os.path.join(egg_info, 'spec')
    if not os.path.isdir(spec_dir):
        log.info("creating dir %r" % spec_dir)
        os.mkdir(spec_dir)
    path = os.path.join(spec_dir, 'depend')
    log.info("writing %r" % path)
    fo = open(path, 'w')<commit_msg>fixed bug occurring when dependencies are listed multiple times<commit_after>"""setuptools.command.bdist_egg

Build .egg distributions"""

# This module should be kept compatible with Python 2.3
import sys, os, marshal, re
from setuptools import Command
from distutils.dir_util import remove_tree, mkpath
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
from distutils.errors import DistutilsSetupError
from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint
from types import CodeType
from setuptools.extension import Library


def strip_module(filename):
    if '.' in filename:
        filename = os.path.splitext(filename)[0]
    if filename.endswith('module'):
        filename = filename[:-6]
    return filename


def write_spec_depend(egg_info):
    """
    egg_info is the path to the EGG-INFO directory
    """
    from enstaller.indexed_repo.metadata import data_from_spec

    pkg_info = open(os.path.join(egg_info, 'PKG-INFO')).read()

    spec = {'build': 1, 'arch':None, 'platform':None, 'osdist':None,
            'python': '%i.%i' % sys.version_info[:2],
            'packages': []
            }
    for var in ['name', 'version']:
        pat = re.compile(r'^%s:\s*(\S+)' % var, re.M | re.I)
        spec[var] = pat.search(pkg_info).group(1)

    requires_txt = os.path.join(egg_info, 'requires.txt')
    pat = re.compile(r'[\w\-.]+')
    pkgs = set()
    if os.path.isfile(requires_txt):
        for line in open(requires_txt):
            m = pat.match(line.strip())
            if m:
                pkgs.add(m.group())
    spec['packages'] = list(pkgs)

    spec_dir = os.path.join(egg_info, 'spec')
    if not os.path.isdir(spec_dir):
        log.info("creating dir %r" % spec_dir)
        os.mkdir(spec_dir)
    path = os.path.join(spec_dir, 'depend')
    log.info("writing %r" % path)
    fo = open(path, 'w')
{'fraction_non_alphanumeric': 0.12995245641838352, 'fraction_numerical': 0.0036978341257263604, 'mean_word_length': 3.250280583613917, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6251740', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1210, 'n_words': 303}