update Setup for python3 compatibility; temporarily use ConfigParser for python2 compatibility
This commit is contained in:
parent
e16edef965
commit
c17842452b
|
@ -4,7 +4,7 @@ from sys import argv
|
|||
from re import match
|
||||
from pprint import pformat
|
||||
|
||||
from configparser import RawConfigParser
|
||||
from ConfigParser import RawConfigParser
|
||||
|
||||
class Configuration(RawConfigParser):
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from fileinput import FileInput
|
|||
from re import sub, match
|
||||
from fnmatch import fnmatch
|
||||
|
||||
from Configuration import *
|
||||
from .Configuration import *
|
||||
|
||||
class Setup:
|
||||
|
||||
|
@ -30,7 +30,7 @@ class Setup:
|
|||
for location in locations:
|
||||
if exists(location):
|
||||
for root, dirs, files in walk(location, followlinks=True):
|
||||
if exists(join(root, "__init__.py")):
|
||||
if exists(join(root, "__init__.py")):
|
||||
packages.append(root.replace(sep, "."))
|
||||
return packages
|
||||
|
||||
|
@ -50,15 +50,15 @@ class Setup:
|
|||
def remove_excluded(self, paths, root, exclude):
|
||||
removal = []
|
||||
for path in paths:
|
||||
if self.contains_path(join(root, path), exclude):
|
||||
if self.contains_path(join(root, path), exclude):
|
||||
removal.append(path)
|
||||
for path in removal:
|
||||
if path in paths:
|
||||
if path in paths:
|
||||
paths.remove(path)
|
||||
return paths
|
||||
|
||||
def contains_path(self, path, container):
|
||||
return any(fnmatch(path, rule) or fnmatch(basename(path), rule) for rule in container)
|
||||
return any(fnmatch(path, rule) or fnmatch(basename(path), rule) for rule in container)
|
||||
|
||||
def translate_title(self):
|
||||
config = self.config.get_section("setup")
|
||||
|
@ -93,12 +93,12 @@ class Setup:
|
|||
return translation
|
||||
|
||||
def setup(self, windows=[], options={}):
|
||||
print "running setup..."
|
||||
print("running setup...")
|
||||
self.remove_old_mainfest()
|
||||
config = self.config.get_section("setup")
|
||||
scripts = []
|
||||
if config["init-script"]:
|
||||
scripts.append(config["init-script"])
|
||||
scripts = []
|
||||
if config["init-script"]:
|
||||
scripts.append(config["init-script"])
|
||||
setup(cmdclass={"install": insert_resource_path},
|
||||
name=self.translate_title(),
|
||||
packages=self.build_package_list(),
|
||||
|
@ -114,8 +114,8 @@ class Setup:
|
|||
author=config["contact-name"],
|
||||
author_email=config["contact-email"],
|
||||
url=config["url"],
|
||||
windows=windows,
|
||||
options=options)
|
||||
windows=windows,
|
||||
options=options)
|
||||
|
||||
|
||||
class insert_resource_path(install):
|
||||
|
@ -134,4 +134,4 @@ class insert_resource_path(install):
|
|||
if match(pattern, line):
|
||||
line = sub("=.*$", "= \"{0}\"".\
|
||||
format(config["installation-path"]), line)
|
||||
print line.strip("\n")
|
||||
print(line.strip("\n"))
|
||||
|
|
Loading…
Reference in New Issue