Setup replaces special chars in dist file name, forces rebuild of MANIFEST

This commit is contained in:
Frank DeMarco 2012-08-02 17:28:49 -04:00
parent ff50528e09
commit d3374b5820
2 changed files with 11 additions and 4 deletions

View File

@ -80,6 +80,8 @@ class Configuration(RawConfigParser):
set_option(section, "requirements", "")
set_option(section, "main-object", "pgfw/Game.py")
set_option(section, "resources-path-identifier", "resources_path")
set_option(section, "special-char-placeholder", "_")
set_option(section, "whitespace-placeholder", "-")
section = "display"
add_section(section)
set_option(section, "dimensions", "480, 320")
@ -186,7 +188,8 @@ class Configuration(RawConfigParser):
if self.has_option(section, option):
exclude = self.get(section, option)
exclude += [".git", ".gitignore", "README", "build/", "dist/",
"setup.py", "MANIFEST", self.get("setup", "package-root"),
"setup.py", "MANIFEST", "PKG-INFO",
self.get("setup", "package-root"),
self.get("setup", "changelog")]
self.set(section, option, exclude)

View File

@ -1,6 +1,6 @@
from os import walk, remove
from os.path import sep, join, exists, normpath
from re import findall
from re import findall, sub
from distutils.core import setup
from distutils.command.install import install
from pprint import pprint
@ -12,9 +12,10 @@ from Configuration import *
class Setup:
config = Configuration()
manifest_path = "MANIFEST"
def remove_old_mainfest(self):
path = "MANIFEST"
path = self.manifest_path
if exists(path):
remove(path)
@ -49,7 +50,9 @@ class Setup:
return paths
def translate_title(self):
return self.config.get("setup", "title").replace(" ", "-")
config = self.config.get_section("setup")
title = config["title"].replace(" ", config["whitespace-placeholder"])
return sub("[^\w-]", config["special-char-placeholder"], title)
def build_description(self):
description = ""
@ -79,6 +82,7 @@ class Setup:
return translation
def setup(self):
self.remove_old_mainfest()
config = self.config.get_section("setup")
setup(cmdclass={"install": insert_resources_path},
name=self.translate_title(),