<commit_before>import os
from glob import glob
#from distutils.command.build_py import *
from distutils.command.build_py import build_py as old_build_py
from fnmatch import fnmatch

def is_setup_script(file):
    file = os.path.basename(file)
    return fnmatch(file,"setup.py")
    #return (fnmatch(file,"setup.py") or fnmatch(file,"setup_*.py"))

def in_build_py_ignore(file, _cache={}):
    base,file = os.path.split(file)
    ignore_list = _cache.get(base)
    if ignore_list is None:
        ignore_list = []
        fn = os.path.join(base,'.build_py_ignore')
        if os.path.isfile(fn):
            f = open(fn,'r')
            ignore_list = [x for x in f.read().split('\n') if x]
            f.close()
        _cache[base] = ignore_list
    return file in ignore_list

class build_py(old_build_py):

    def find_package_modules (self, package, package_dir):
        # we filter all files that are setup.py or setup_xxx.py
        # or listed in .build_py_ignore file of files base directory.<commit_msg>Fixed 'setup.py sdist'->untar->'setup.py build' cycle.<commit_after>
import os
import sys
from glob import glob
#from distutils.command.build_py import *
from distutils.command.build_py import build_py as old_build_py
from fnmatch import fnmatch

def is_setup_script(file):
    file = os.path.basename(file)
    return fnmatch(file,"setup.py")
    #return (fnmatch(file,"setup.py") or fnmatch(file,"setup_*.py"))

def in_build_py_ignore(file, _cache={}):
    base,file = os.path.split(file)
    ignore_list = _cache.get(base)
    if ignore_list is None:
        ignore_list = []
        fn = os.path.join(base,'.build_py_ignore')
        if os.path.isfile(fn):
            f = open(fn,'r')
            ignore_list = [x for x in f.read().split('\n') if x]
            f.close()
        _cache[base] = ignore_list
    return file in ignore_list

class build_py(old_build_py):

    def find_package_modules(self, package, package_dir):
        # we filter all files that are setup.py or setup_xxx.py
        # or listed in .build_py_ignore file of files base directory.
        if 'sdist' in sys.argv:
            return old_build_py.find_package_modules(self,package,package_dir)

{'fraction_non_alphanumeric': 0.11131386861313869, 'fraction_numerical': 0.0, 'mean_word_length': 3.161290322580645, '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': '5507670', 'n_tokens_mistral': 722, 'n_tokens_neox': 721, 'n_words': 185}