pypi-techtonik /

Full commit
# Subset of setuptools' pkg_resources module
# for file name normalization
import re

def safe_name(name):
    """Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    return re.sub('[^A-Za-z0-9.]+', '-', name)

def safe_version(version):
    """Convert an arbitrary string to a standard version string

    Spaces become dots, and all other non-alphanumeric characters become
    dashes, with runs of multiple dashes condensed to a single dash.
    version = version.replace(' ','.')
    return re.sub('[^A-Za-z0-9.]+', '-', version)

def to_filename(name):
    """Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    return name.replace('-','_')