Skip to content

Commit

Permalink
setup.py: Consider the case self.root == None
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowKyogre committed Jul 22, 2014
1 parent f79a1cd commit f39369e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def finalize_options(self):

def run (self):
_install.run(self)

# Rewrite with constants if needed
for f in self.get_outputs():
# If is package __init__.py file holding some constants
Expand All @@ -45,10 +44,14 @@ def run (self):
replace_me = os.path.join(self.install_data,'share/qtarot')
elif self.prefix:
replace_me = os.path.join(self.prefix,'share/qtarot')
if self.root[-1] == '/':

if self.root == None:
consts = [['DATA_DIR', replace_me.replace(os.sep,'/')]]
elif self.root[-1] == '/':
consts = [['DATA_DIR', replace_me.replace(self.root[:-2],'')]]
else:
consts = [['DATA_DIR', replace_me.replace(self.root,'')]]

script = open(f, 'w', encoding='utf-8')
script.write(content[:const_begin] + \
"### CONSTANTS BEGIN ###")
Expand Down

0 comments on commit f39369e

Please sign in to comment.