Commit 79c68527 authored by Matt Behrens's avatar Matt Behrens

disable install unless given a destination directory, to allay fears of

people destroying their site-packages directories; this should hold us
until the installer is done and merged... hopefully in 2.7...

also detabify (I should do this more often)
parent 52d70e30
...@@ -56,16 +56,17 @@ setup_info = {} ...@@ -56,16 +56,17 @@ setup_info = {}
def setup(name=None, author=None, cmdclass=None, **kwargs): def setup(name=None, author=None, cmdclass=None, **kwargs):
setup_info = sys.modules[__name__].setup_info setup_info = sys.modules[__name__].setup_info
for keyword in kwargs.keys(): for keyword in kwargs.keys():
if not setup_info.has_key(keyword): if not setup_info.has_key(keyword):
setup_info[keyword] = [] setup_info[keyword] = []
setup_info[keyword] += kwargs[keyword] setup_info[keyword] += kwargs[keyword]
# Override install_data to install into module directories, and to support # Override install_data to install into module directories, and to support
# globbing on data_files. # globbing on data_files.
from types import StringType from types import StringType
from distutils.command.install import install
from distutils.command.install_data import install_data from distutils.command.install_data import install_data
from distutils.errors import DistutilsFileError from distutils.errors import DistutilsFileError, DistutilsOptionError
from distutils.util import convert_path from distutils.util import convert_path
from glob import glob from glob import glob
...@@ -115,6 +116,37 @@ class install_data(install_data): ...@@ -115,6 +116,37 @@ class install_data(install_data):
(out, _) = self.copy_file(g, dir) (out, _) = self.copy_file(g, dir)
self.outfiles.append(out) self.outfiles.append(out)
class install(install):
def finalize_unix (self):
if self.install_base is not None or self.install_platbase is not None:
if ((self.install_lib is None and
self.install_purelib is None and
self.install_platlib is None) or
self.install_headers is None or
self.install_scripts is None or
self.install_data is None):
raise DistutilsOptionError, \
"install-base or install-platbase supplied, but " + \
"installation scheme is incomplete"
return
if self.home is not None:
self.install_base = self.install_platbase = self.home
self.select_scheme("unix_home")
else:
if self.prefix is None:
if self.exec_prefix is not None:
raise DistutilsOptionError, \
"must not supply exec-prefix without prefix"
raise DistutilsOptionError, "must supply installation path"
else:
if self.exec_prefix is None:
self.exec_prefix = self.prefix
self.install_base = self.prefix
self.install_platbase = self.exec_prefix
self.select_scheme("unix_prefix")
AUTHOR = 'Zope Corporation and Contributors' AUTHOR = 'Zope Corporation and Contributors'
ZOPE_ROOT = os.path.abspath(os.getcwd()) ZOPE_ROOT = os.path.abspath(os.getcwd())
EXTENSIONCLASS_ROOT = os.path.join(ZOPE_ROOT, 'lib', 'Components', 'ExtensionClass') EXTENSIONCLASS_ROOT = os.path.join(ZOPE_ROOT, 'lib', 'Components', 'ExtensionClass')
...@@ -714,11 +746,11 @@ setup( ...@@ -714,11 +746,11 @@ setup(
author=AUTHOR, author=AUTHOR,
packages=['Products.PluginIndexes', packages=['Products.PluginIndexes',
'Products.PluginIndexes.DateIndex', 'Products.PluginIndexes.DateIndex',
'Products.PluginIndexes.DateIndex.tests', 'Products.PluginIndexes.DateIndex.tests',
'Products.PluginIndexes.DateRangeIndex', 'Products.PluginIndexes.DateRangeIndex',
'Products.PluginIndexes.DateRangeIndex.tests', 'Products.PluginIndexes.DateRangeIndex.tests',
'Products.PluginIndexes.FieldIndex', 'Products.PluginIndexes.FieldIndex',
'Products.PluginIndexes.FieldIndex.tests', 'Products.PluginIndexes.FieldIndex.tests',
'Products.PluginIndexes.KeywordIndex', 'Products.PluginIndexes.KeywordIndex',
'Products.PluginIndexes.KeywordIndex.tests', 'Products.PluginIndexes.KeywordIndex.tests',
...@@ -737,11 +769,11 @@ setup( ...@@ -737,11 +769,11 @@ setup(
data_files=[['Products/PluginIndexes', ['Products/PluginIndexes/*.txt']], data_files=[['Products/PluginIndexes', ['Products/PluginIndexes/*.txt']],
['Products/PluginIndexes/DateIndex', ['Products/PluginIndexes/DateIndex',
['Products/PluginIndexes/DateIndex/README.txt']], ['Products/PluginIndexes/DateIndex/README.txt']],
['Products/PluginIndexes/DateIndex/dtml', ['Products/PluginIndexes/DateIndex/dtml',
['Products/PluginIndexes/DateIndex/dtml/*']], ['Products/PluginIndexes/DateIndex/dtml/*']],
['Products/PluginIndexes/DateRangeIndex', ['Products/PluginIndexes/DateRangeIndex',
['Products/PluginIndexes/DateRangeIndex/README.txt']], ['Products/PluginIndexes/DateRangeIndex/README.txt']],
['Products/PluginIndexes/DateRangeIndex/dtml', ['Products/PluginIndexes/DateRangeIndex/dtml',
['Products/PluginIndexes/DateRangeIndex/dtml/*']], ['Products/PluginIndexes/DateRangeIndex/dtml/*']],
['Products/PluginIndexes/FieldIndex/dtml', ['Products/PluginIndexes/FieldIndex/dtml',
...@@ -883,7 +915,7 @@ setup( ...@@ -883,7 +915,7 @@ setup(
'Products.Transience.tests'], 'Products.Transience.tests'],
data_files=[['Products/Transience', ['Products/Transience/*.stx']], data_files=[['Products/Transience', ['Products/Transience/*.stx']],
['Products/Transience/dtml', ['Products/Transience/dtml/*']], ['Products/Transience/dtml', ['Products/Transience/dtml/*']],
['Products/Transience/help', ['Products/Transience/help',
['Products/Transience/help/*.stx']], ['Products/Transience/help/*.stx']],
['Products/Transience/www', ['Products/Transience/www/*']]], ['Products/Transience/www', ['Products/Transience/www/*']]],
...@@ -912,19 +944,19 @@ setup( ...@@ -912,19 +944,19 @@ setup(
author=AUTHOR, author=AUTHOR,
ext_modules=[ ext_modules=[
Extension(name='Products.ZCTextIndex.stopper', Extension(name='Products.ZCTextIndex.stopper',
sources=['Products/ZCTextIndex/stopper.c']), sources=['Products/ZCTextIndex/stopper.c']),
Extension(name='Products.ZCTextIndex.okascore', Extension(name='Products.ZCTextIndex.okascore',
sources=['Products/ZCTextIndex/okascore.c'])], sources=['Products/ZCTextIndex/okascore.c'])],
packages=['Products.ZCTextIndex', 'Products.ZCTextIndex.tests'], packages=['Products.ZCTextIndex', 'Products.ZCTextIndex.tests'],
data_files=[['Products/ZCTextIndex', ['Products/ZCTextIndex/README.txt']], data_files=[['Products/ZCTextIndex', ['Products/ZCTextIndex/README.txt']],
['Products/ZCTextIndex/dtml', ['Products/ZCTextIndex/dtml/*']], ['Products/ZCTextIndex/dtml', ['Products/ZCTextIndex/dtml/*']],
['Products/ZCTextIndex/help', ['Products/ZCTextIndex/help/*']], ['Products/ZCTextIndex/help', ['Products/ZCTextIndex/help/*']],
['Products/ZCTextIndex/tests', ['Products/ZCTextIndex/tests',
['Products/ZCTextIndex/tests/python.txt']], ['Products/ZCTextIndex/tests/python.txt']],
['Products/ZCTextIndex/www', ['Products/ZCTextIndex/www/*']]], ['Products/ZCTextIndex/www', ['Products/ZCTextIndex/www/*']]],
cmdclass={'install_data': install_data} cmdclass={'install_data': install_data}
) )
...@@ -988,13 +1020,14 @@ distutils_setup( ...@@ -988,13 +1020,14 @@ distutils_setup(
headers=setup_info.get('headers', []), headers=setup_info.get('headers', []),
ext_modules=setup_info.get('ext_modules', []), ext_modules=setup_info.get('ext_modules', []),
cmdclass={'install_data': install_data} cmdclass={'install': install, 'install_data': install_data}
) )
distutils_setup( distutils_setup(
name='Zope', name='Zope',
author=AUTHOR, author=AUTHOR,
py_modules=setup_info.get('py_modules', []) py_modules=setup_info.get('py_modules', []),
cmdclass={'install': install, 'install_data': install_data}
) )
setup_info = {} setup_info = {}
...@@ -1071,11 +1104,12 @@ distutils_setup( ...@@ -1071,11 +1104,12 @@ distutils_setup(
headers=setup_info.get('headers', []), headers=setup_info.get('headers', []),
ext_modules=setup_info.get('ext_modules', []), ext_modules=setup_info.get('ext_modules', []),
cmdclass={'install_data': install_data} cmdclass={'install': install, 'install_data': install_data}
) )
distutils_setup( distutils_setup(
name='Zope', name='Zope',
author=AUTHOR, author=AUTHOR,
py_modules=setup_info.get('py_modules', []) py_modules=setup_info.get('py_modules', []),
cmdclass={'install': install, 'install_data': install_data}
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment