<commit_before>#!/usr/bin/python
import os
import shutil
import glob
from utils import *

pylonsDir = "./dist/pylons"

def setup(distPath):
  if os.path.exists(distPath):
    shutil.rmtree(distPath)
  makeDistDirs(distPath)
  shutil.copytree("./webapp/socorro", "./dist/pylons/socorro")

  # remove any pyc files
  for root, dirs, files in os.walk(distPath):
    for name in files:
      if name.endswith(".pyc"):
        os.remove(os.path.join(root, name))

  topLevel = ["production.ini.dist", "setup.py", "setup.cfg", "README.txt"]
  for name in topLevel:
    shutil.copy(os.path.join("./webapp/", name),
                os.path.join(pylonsDir, name))
  
setup(pylonsDir)<commit_msg>dist script that actually works<commit_after>#!/usr/bin/python
import os
import shutil
import glob
from utils import *

pylonsDir = "./dist/pylons"
webapp = "./webapp/socorro/"

def distFilter(tocopy, dirname, names):
  subtree = dirname[len(webapp):]
  for name in names:
    if (name == ".svn"):
      names.remove(name)
  for name in names:
    if (name.endswith("pyc") or name.endswith("~") or
        name.startswith("#")):
      pass
    else:
      tocopy.append((os.path.join(dirname, name),
                     os.path.join(pylonsDir, "socorro", subtree, name)))

def setup(distPath):
  makeDistDirs(distPath)
  if not os.path.exists(os.path.join(distPath, "socorro")):
    os.makedirs(os.path.join(distPath, "socorro"))

  toCopy = []
  os.path.walk(webapp, distFilter, toCopy)
  for (src, dest) in toCopy:
    if os.path.isdir(src):
      if not os.path.exists(dest):
        os.mkdir(dest)
    else:
      shutil.copy(src, dest)

  topLevel = ["production.ini.dist", "setup.py", "setup.cfg", "README.txt"]
  for name in topLevel:
    shutil.copy(os.path.join("./webapp/", name),
                os.path.join(pylonsDir, name))
  
setup(pylonsDir)
{'fraction_non_alphanumeric': 0.15889370932754882, 'fraction_numerical': 0.0, 'mean_word_length': 3.1931818181818183, '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': '4190061', 'n_tokens_mistral': 693, 'n_tokens_neox': 676, 'n_words': 142}