<commit_before>#!/usr/bin/env python

import os.path, sys, os
from distutils.core import setup

fixf = os.path.normpath

def Walk(root='.'):
    """
    A really really scaled down version of what we have in tools.py.
    """
    # initialize
    result = []

    # must have at least root folder
    try:
        names = os.listdir(root)
    except os.error:
        return result

    # check each file
    for name in names:
        fullname = os.path.normpath(os.path.join(root, name))

        # recursively scan other folders, appending results
        if os.path.isdir(fullname) and not os.path.islink(fullname):
            result.append(fullname)
            result = result + Walk(fullname)
                
    return result

# this affects the names of all the directories we do stuff with
VERSION="cvs"
PVER = "pyblosxom-" + VERSION

# we grab all the files in the contrib directory
contrib_folders = Walk("contrib")

doc_files = ["INSTALL", "LICENSE", 
             fixf("docs/README.contrib"), fixf("docs/README.plugins"), 
             fixf("docs/ReadMeForPlugins.py")]

# FIXME - this doesn't account for a variety of platforms
if sys.platform == "win32":
    pydf = []
    root = "c:\\Program Files\\" + PVER + "\\"

    for mem in contrib_folders:
        f = os.listdir(mem)
        f = [mem + os.sep + m for m in f if m.endswith(".py")]
        pydf.append( (root + mem, f) )

elif sys.platform in ["linux1", "linux2"]:
    # we want to move the web script files as well, so we sneak them
    # in here.
    pydf=[ ("/usr/share/" + PVER + "/web", ["web/pyblosxom.cgi", 
                                            "web/xmlrpc.cgi", 
                                            "web/config.py"]),
           ("/usr/share/doc/" + PVER, doc_files) ]

    root = "/usr/share/" + PVER + "/"
    for mem in contrib_folders:
        f = os.listdir(mem)
        f = [mem + os.sep + m for m in f if m.endswith(".py")]
        pydf.append( (root + mem, f) )

else:
    # we don't know what platform they have, so we print out
    # this message and hope they tell us.  it'd be nice if i
    # could find a listing of the possible platforms, but i suck.
    # (wbg 7/31/2003)
    pydf = []
    print """
NOTE: We want to install documentation, contributed plugins, and
the web scripts to some central location where you can access them.
However, we don't know where to put it for your platform.  If you could
send an email to <<EMAIL>> with the following
information:

  Dear Pyblosxom Users,
  I have platform '""" + sys.platform + """' and you told me to send you
  an email with this information!
  Sincerely,
  <your name>

Thanks!

In the meantime, you'll have to put the docs, contributed plugins, and
web scripts where you want them on your own.  They're in subdirectories
of this one: web/, contrib/ and docs/ .  Sorry for the inconvenience.<commit_msg>Adjusted setup.py so that it grabs all non-CVS files in contrib.<commit_after>#!/usr/bin/env python

import os.path, sys, os
from distutils.core import setup

fixf = os.path.normpath

def Walk(root='.'):
    """
    A really really scaled down version of what we have in tools.py.
    """
    # initialize
    result = []

    # must have at least root folder
    try:
        names = os.listdir(root)
    except os.error:
        return result

    # check each file
    for name in names:
        fullname = os.path.normpath(os.path.join(root, name))

        # recursively scan other folders, appending results
        if os.path.isdir(fullname) and not os.path.islink(fullname):
            result.append(fullname)
            result = result + Walk(fullname)
                
    return result

# this affects the names of all the directories we do stuff with
VERSION="cvs"
PVER = "pyblosxom-" + VERSION

# we grab all the files in the contrib directory
contrib_folders = Walk("contrib")

doc_files = ["INSTALL", "LICENSE", 
             fixf("docs/README.contrib"), fixf("docs/README.plugins"), 
             fixf("docs/ReadMeForPlugins.py")]

def is_goodfile(path, f):
    if f in ["CVS"] or os.path.isdir(path + os.sep + f):
        return 0
    return 1

# FIXME - this doesn't account for a variety of platforms
if sys.platform == "win32":
    pydf = []
    root = "c:\\Program Files\\" + PVER + "\\"

    for mem in contrib_folders:
        f = os.listdir(mem)
        f = [mem + os.sep + m for m in f if is_goodfile(mem, m)]
        pydf.append( (root + mem, f) )

elif sys.platform in ["linux1", "linux2"]:
    # we want to move the web script files as well, so we sneak them
    # in here.
    pydf=[ ("/usr/share/" + PVER + "/web", ["web/pyblosxom.cgi", 
                                            "web/xmlrpc.cgi", 
                                            "web/config.py"]),
           ("/usr/share/doc/" + PVER, doc_files) ]

    root = "/usr/share/" + PVER + "/"
    for mem in contrib_folders:
        f = os.listdir(mem)
        f = [mem + os.sep + m for m in f if is_goodfile(mem, m)]
        pydf.append( (root + mem, f) )

else:
    # we don't know what platform they have, so we print out
    # this message and hope they tell us.  it'd be nice if i
    # could find a listing of the possible platforms, but i suck.
    # (wbg 7/31/2003)
    pydf = []
    print """
NOTE: We want to install documentation, contributed plugins, and
the web scripts to some central location where you can access them.
However, we don't know where to put it for your platform.  If you could
send an email to <<EMAIL>> with the following
information:

  Dear Pyblosxom Users,
  I have platform '""" + sys.platform + """' and you told me to send you
  an email with this information!
  Sincerely,
  <your name>

Thanks!

In the meantime, you'll have to put the docs, contributed plugins, and
web scripts where you want them on your own.  They're in subdirectories
of this one: web/, contrib/ and docs/ .  Sorry for the inconvenience.
{'fraction_non_alphanumeric': 0.1104720013534089, 'fraction_numerical': 0.004060226695990526, 'mean_word_length': 2.3344613649182175, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1604906', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1786, 'n_words': 692}