Skip to content

Commit

Permalink
Remove 'setprefix.py', and move functionality directly into setup.py.
Browse files Browse the repository at this point in the history
Prefix is now set during 'python setup.py build' when supplied with the
--mythtv-prefix flag.
  • Loading branch information
wagnerrp committed Jan 2, 2011
1 parent aaf8cd6 commit eab21fb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 deletions.
5 changes: 2 additions & 3 deletions mythtv/bindings/python/Makefile
Expand Up @@ -18,9 +18,8 @@ clean:

distclean: clean

python_build: setup.py setprefix.py
$(PYTHON) setup.py build
$(PYTHON) setprefix.py "$(REAL_PREFIX)"
python_build: setup.py
$(PYTHON) setup.py build --mythtv-prefix="$(REAL_PREFIX)"

install: setup.py
$(PYTHON) setup.py install --skip-build $(ROOT_FLAGS) $(PREFIX_FLAGS)
Expand Down
25 changes: 0 additions & 25 deletions mythtv/bindings/python/setprefix.py

This file was deleted.

37 changes: 36 additions & 1 deletion mythtv/bindings/python/setup.py
Expand Up @@ -4,6 +4,8 @@
from distutils.cmd import Command
from distutils.sysconfig import get_python_lib
from distutils.command.install import INSTALL_SCHEMES
from distutils.command.build import build as pybuild

import os
import glob

Expand Down Expand Up @@ -31,6 +33,38 @@ def run(self):
print 'unlinking '+os.path.join(install_path, fname)
os.unlink(os.path.join(install_path, fname))

class build(pybuild):
user_options = pybuild.user_options + [('mythtv-prefix=', None, 'MythTV installation prefix')]
def initialize_options(self):
pybuild.initialize_options(self)
self.mythtv_prefix = None
def run(self):
pybuild.run(self)

# check for alternate prefix
if self.mythtv_prefix is None:
return

# find file
for path,dirs,files in os.walk('build'):
if 'static.py' in files:
break
else:
return

# read in and replace existing line
buff = []
path = os.path.join(path,'static.py')
with open(path) as fi:
for line in fi:
if 'INSTALL_PREFIX' in line:
line = "INSTALL_PREFIX = '%s'\n" % self.mythtv_prefix
buff.append(line)

# push back to file
with open(path,'w') as fo:
fo.write(''.join(buff))

setup(
name='MythTV',
version='0.24.0',
Expand All @@ -41,5 +75,6 @@ def run(self):
url=['http://www.mythtv.org/'],
scripts=['scripts/mythpython', 'scripts/mythwikiscripts'],
requires=['MySQLdb','lxml'],
cmdclass={'uninstall':uninstall},
cmdclass={'uninstall':uninstall,
'build':build},
)

0 comments on commit eab21fb

Please sign in to comment.