Setup builds data map for distutils
This commit is contained in:
parent
97d2f9fcbc
commit
1ac155f10a
|
@ -1,12 +1,12 @@
|
|||
from os import walk, remove
|
||||
from os.path import sep, join, exists, realpath, relpath
|
||||
from os.path import sep, join, exists, normpath
|
||||
from re import findall
|
||||
|
||||
from configuration.Configuration import *
|
||||
|
||||
class Setup:
|
||||
|
||||
config = Configuration(local=True)
|
||||
config = Configuration()
|
||||
|
||||
@classmethod
|
||||
def remove_old_mainfest(self):
|
||||
|
@ -28,22 +28,27 @@ class Setup:
|
|||
include = []
|
||||
config = self.config.get_section("setup")
|
||||
install_root = config["installation-path"]
|
||||
exclude = config["data-exclude"]
|
||||
exclude = map(normpath, config["data-exclude"])
|
||||
print exclude
|
||||
for root, dirs, files in walk("."):
|
||||
removal = []
|
||||
for directory in dirs:
|
||||
if realpath(join(root, directory)) in exclude:
|
||||
removal.append(directory)
|
||||
for directory in removal:
|
||||
dirs.remove(directory)
|
||||
if root != ".":
|
||||
destination = join(install_root, relpath(root))
|
||||
listing = []
|
||||
for file_name in files:
|
||||
listing.append(join(root, file_name))
|
||||
include.append((destination, listing))
|
||||
dirs = self.remove_excluded_dirs(dirs, root, exclude)
|
||||
for file_name in files:
|
||||
path = normpath(join(root, file_name))
|
||||
if path not in exclude:
|
||||
include.append((normpath(join(config["installation-path"],
|
||||
root)), path))
|
||||
return include
|
||||
|
||||
@classmethod
|
||||
def remove_excluded_dirs(self, dirs, root, exclude):
|
||||
removal = []
|
||||
for directory in dirs:
|
||||
if normpath(join(root, directory)) in exclude:
|
||||
removal.append(directory)
|
||||
for directory in removal:
|
||||
dirs.remove(directory)
|
||||
return dirs
|
||||
|
||||
@classmethod
|
||||
def translate_title(self):
|
||||
return self.config["game-title"].replace(" ", "-")
|
||||
|
|
Loading…
Reference in New Issue