<commit_before>
import os
import subprocess

#win32 / dds / block compression / mips / cubemaps
print("texture conversion, mip generation and compression" + "\n")

nvtt_dir = os.getcwd() + "\\..\\tools\\bin\\nvtt\\win32\\"
texture_dir = os.getcwd() + "\\assets\\textures\\"
build_dir = os.getcwd() + "\\bin\\win32\\data\\textures\\"

#create textures dir
if not os.path.exists(build_dir):
    os.makedirs(build_dir)

print("processing directory: " + texture_dir + "\n")

for f in os.listdir(texture_dir):
    [fnoext, fext] = os.path.splitext(f)
    print(f)
    print(fnoext)
    print(nvtt_dir)
    if f.find(".png") != -1 or f.find(".jpg") or f.find(".tif") != -1:
        print("converting texture")
        cmdline = nvtt_dir + "nvcompress -rgb " + texture_dir + f + " " + build_dir + fnoext + ".dds"
    if f.find(".dds") != -1:
        print("copying texture")
        #straight copy
    subprocess.check_call(cmdline)
    print("\n")
<commit_msg>get build textures python script running in a platfrom agnostic manner, texture compression tools working now on osx<commit_after>import os
import subprocess
import shutil

# win32 / dds / block compression / mips / cubemaps
print("texture conversion, mip generation and compression" + "\n")

platform_name = "win32"
if os.name == "posix":
    platform_name = "osx"

nvtt_dir = os.path.join(os.getcwd(), "..", "tools", "bin", "nvtt", platform_name, "nvcompress")
texture_dir = os.path.join(os.getcwd(), "assets", "textures")
build_dir = os.path.join(os.getcwd(), "bin", platform_name, "data", "textures")

# create textures dir
if not os.path.exists(build_dir):
    os.makedirs(build_dir)

print("processing directory: " + texture_dir + "\n")

for f in os.listdir(texture_dir):
    [fnoext, fext] = os.path.splitext(f)
    print(f)
    dds_filename = fnoext + ".dds"
    dest_path = os.path.join(build_dir, dds_filename)
    src_path = os.path.join(texture_dir, f)
    if f.find(".png") != -1 or f.find(".jpg") or f.find(".tif") != -1:
        print("converting texture to data dir")
        cmdline = nvtt_dir + " -rgb " + src_path + " " + dest_path
        subprocess.check_call(cmdline, shell=True)
    if f.find(".dds") != -1:
        print("copying texture to data dir")
        # straight copy
        dest_file = os.path.join(build_dir, f)
        shutil(f, dest_file)
    print("\n")

{'fraction_non_alphanumeric': 0.1636828644501279, 'fraction_numerical': 0.0068201193520886615, 'mean_word_length': 3.2985347985347984, 'pattern_counts': {'":': 1, '<': 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': '4788679', 'n_tokens_mistral': 853, 'n_tokens_neox': 836, 'n_words': 200}