Whitespace normalization. Unka Timmy would be proud.

This commit is contained in:
Barry Warsaw 2002-04-23 18:18:43 +00:00
parent b957bc3dcc
commit 8570013357
2 changed files with 57 additions and 57 deletions

View File

@ -2,7 +2,7 @@
Modified from bdist_dumb by Mark W. Alexander <slash@dotnetslash.net> Modified from bdist_dumb by Mark W. Alexander <slash@dotnetslash.net>
Implements the Distutils 'bdist_packager' abstract command Implements the Distutils 'bdist_packager' abstract command
to be subclassed by binary package creation commands.""" to be subclassed by binary package creation commands."""
@ -33,7 +33,7 @@ class bdist_packager (Command):
"Software category (packager dependent format)"), "Software category (packager dependent format)"),
('revision=', None, ('revision=', None,
"package revision number"), "package revision number"),
# the following have moved into the distribution class # the following have moved into the distribution class
#('packager=', None, #('packager=', None,
#"Package maintainer"), #"Package maintainer"),
#('packager-mail=', None, #('packager-mail=', None,
@ -199,10 +199,10 @@ class bdist_packager (Command):
self.ensure_string('category') self.ensure_string('category')
self.ensure_string('revision',"1") self.ensure_string('revision',"1")
#self.ensure_string('url',d.get_url()) #self.ensure_string('url',d.get_url())
if type(self.distribution.packages) == type([]): if type(self.distribution.packages) == type([]):
self.root_package=self.distribution.packages[0] self.root_package=self.distribution.packages[0]
else: else:
self.root_package=self.name self.root_package=self.name
self.ensure_string('root_package',self.root_package) self.ensure_string('root_package',self.root_package)
#self.ensure_string_list('keywords') #self.ensure_string_list('keywords')
#self.ensure_string_not_none('author', d.get_author()) #self.ensure_string_not_none('author', d.get_author())

View File

@ -23,7 +23,7 @@ __revision__ = "$Id: bdist_pkgtool.py,v 0.3 mwa "
# default request script - Is also wrapped around user's request script # default request script - Is also wrapped around user's request script
# unless --no-autorelocate is requested. Finds the python site-packages # unless --no-autorelocate is requested. Finds the python site-packages
# directory and prompts for verification # directory and prompts for verification
DEFAULT_REQUEST="""#!/bin/sh DEFAULT_REQUEST="""#!/bin/sh
###################################################################### ######################################################################
# Distutils internal package relocation support # # Distutils internal package relocation support #
###################################################################### ######################################################################
@ -34,7 +34,7 @@ trap `exit 3` 15
/usr/bin/which python 2>&1 >/dev/null /usr/bin/which python 2>&1 >/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "The python interpretor needs to be on your path!" echo "The python interpretor needs to be on your path!"
echo echo
echo "If you have more than one, make sure the first one is where" echo "If you have more than one, make sure the first one is where"
echo "you want this module installed:" echo "you want this module installed:"
exit 1 exit 1
@ -45,26 +45,26 @@ PY_PKG_DIR=`python -c "import sys;print '%s/lib/python%s/site-packages' % (sys.e
echo "" echo ""
if [ -z "${PY_DIR}" ]; then if [ -z "${PY_DIR}" ]; then
echo "I can't seem to find the python distribution." echo "I can't seem to find the python distribution."
echo "I'm assuming the default path for site-packages" echo "I'm assuming the default path for site-packages"
else else
BASEDIR="${PY_PKG_DIR}" BASEDIR="${PY_PKG_DIR}"
cat <<EOF cat <<EOF
Python found! The default path: Python found! The default path:
${BASEDIR} ${BASEDIR}
will install ${PRODUCT} such that all python users will install ${PRODUCT} such that all python users
can import it. can import it.
If you just want individual access, you can install into If you just want individual access, you can install into
any directory and add that directory to your \$PYTHONPATH any directory and add that directory to your \$PYTHONPATH
EOF EOF
fi fi
echo "" echo ""
BASEDIR=`ckpath -d ${BASEDIR} -ay \ BASEDIR=`ckpath -d ${BASEDIR} -ay \
-p "Where should ${PRODUCT} be installed? [${BASEDIR}]"` || exit $? -p "Where should ${PRODUCT} be installed? [${BASEDIR}]"` || exit $?
###################################################################### ######################################################################
# user supplied request script follows # # user supplied request script follows #
@ -77,8 +77,8 @@ BASEDIR=`ckpath -d ${BASEDIR} -ay \
DEFAULT_POSTINSTALL="""#!/bin/sh DEFAULT_POSTINSTALL="""#!/bin/sh
/usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__ /usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
python -c "import compileall;compileall.compile_dir(\\"${BASEDIR}/__DISTUTILS_NAME__\\")" python -c "import compileall;compileall.compile_dir(\\"${BASEDIR}/__DISTUTILS_NAME__\\")"
chown -R root:other ${BASEDIR}/__DISTUTILS_NAME__ chown -R root:other ${BASEDIR}/__DISTUTILS_NAME__
fi fi
""" """
@ -91,7 +91,7 @@ DEFAULT_PREREMOVE="""#!/bin/sh
/usr/bin/which python 2>&1 >/dev/null /usr/bin/which python 2>&1 >/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "The python interpretor needs to be on your path!" echo "The python interpretor needs to be on your path!"
echo echo
echo "If you have more than one, make sure the first one is where" echo "If you have more than one, make sure the first one is where"
echo "you want this module removed from" echo "you want this module removed from"
exit 1 exit 1
@ -99,8 +99,8 @@ fi
/usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__ /usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
find ${BASEDIR}/__DISTUTILS_NAME__ -name "*.pyc" -exec rm {} \; find ${BASEDIR}/__DISTUTILS_NAME__ -name "*.pyc" -exec rm {} \;
find ${BASEDIR}/__DISTUTILS_NAME__ -name "*.pyo" -exec rm {} \; find ${BASEDIR}/__DISTUTILS_NAME__ -name "*.pyo" -exec rm {} \;
fi fi
""" """
@ -111,9 +111,9 @@ DEFAULT_POSTREMOVE="""#!/bin/sh
/usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__ /usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ `find ${BASEDIR}/__DISTUTILS_NAME__ ! -type d | wc -l` -eq 0 ]; then if [ `find ${BASEDIR}/__DISTUTILS_NAME__ ! -type d | wc -l` -eq 0 ]; then
rm -rf ${BASEDIR}/__DISTUTILS_NAME__ rm -rf ${BASEDIR}/__DISTUTILS_NAME__
fi fi
fi fi
""" """
@ -171,13 +171,13 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
self.ensure_script('postremove') self.ensure_script('postremove')
self.ensure_string('vendor', None) self.ensure_string('vendor', None)
if self.__dict__.has_key('author'): if self.__dict__.has_key('author'):
if self.__dict__.has_key('author_email'): if self.__dict__.has_key('author_email'):
self.ensure_string('vendor', self.ensure_string('vendor',
"%s <%s>" % (self.author, "%s <%s>" % (self.author,
self.author_email)) self.author_email))
else: else:
self.ensure_string('vendor', self.ensure_string('vendor',
"%s" % (self.author)) "%s" % (self.author))
self.ensure_string('category', "System,application") self.ensure_string('category', "System,application")
self.ensure_script('compver') self.ensure_script('compver')
self.ensure_script('depend') self.ensure_script('depend')
@ -188,7 +188,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
raise DistutilsOptionError, \ raise DistutilsOptionError, \
"pkg-abrev (%s) must be less than 9 characters" % self.pkg_abrev "pkg-abrev (%s) must be less than 9 characters" % self.pkg_abrev
# Update default scripts with our metadata name # Update default scripts with our metadata name
DEFAULT_REQUEST = string.replace(DEFAULT_REQUEST, DEFAULT_REQUEST = string.replace(DEFAULT_REQUEST,
"__DISTUTILS_NAME__", self.root_package) "__DISTUTILS_NAME__", self.root_package)
DEFAULT_POSTINSTALL = string.replace(DEFAULT_POSTINSTALL, DEFAULT_POSTINSTALL = string.replace(DEFAULT_POSTINSTALL,
"__DISTUTILS_NAME__", self.root_package) "__DISTUTILS_NAME__", self.root_package)
@ -243,7 +243,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
'compver',None) 'compver',None)
self.write_script(os.path.join(pkg_dir, "depend"), self.write_script(os.path.join(pkg_dir, "depend"),
'depend',None) 'depend',None)
self.announce('Creating prototype file') self.announce('Creating prototype file')
path = os.path.join(pkg_dir, "prototype") path = os.path.join(pkg_dir, "prototype")
self.execute(write_file, self.execute(write_file,
@ -263,14 +263,14 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
pkg_cmd.append(os.environ['PWD']) pkg_cmd.append(os.environ['PWD'])
self.spawn(pkg_cmd) self.spawn(pkg_cmd)
pkg_cmd = ['pkgtrans', '-s', '/var/spool/pkg'] pkg_cmd = ['pkgtrans', '-s', '/var/spool/pkg']
path = os.path.join(os.environ['PWD'],pkg_dir, path = os.path.join(os.environ['PWD'],pkg_dir,
self.get_binary_name() + ".pkg") self.get_binary_name() + ".pkg")
self.announce('Transferring package to ' + pkg_dir) self.announce('Transferring package to ' + pkg_dir)
pkg_cmd.append(path) pkg_cmd.append(path)
pkg_cmd.append(self.pkg_abrev) pkg_cmd.append(self.pkg_abrev)
self.spawn(pkg_cmd) self.spawn(pkg_cmd)
os.system("rm -rf /var/spool/pkg/%s" % self.pkg_abrev) os.system("rm -rf /var/spool/pkg/%s" % self.pkg_abrev)
def run (self): def run (self):
if self.subpackages: if self.subpackages:
@ -281,7 +281,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
self.make_package() self.make_package()
# run() # run()
def _make_prototype(self): def _make_prototype(self):
proto_file = ["i pkginfo"] proto_file = ["i pkginfo"]
if self.request: if self.request:
@ -302,15 +302,15 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
build = self.get_finalized_command('build') build = self.get_finalized_command('build')
try: try:
self.distribution.packages[0] self.distribution.packages[0]
file_list=string.split( file_list=string.split(
getoutput("pkgproto %s/%s=%s" % (build.build_lib, getoutput("pkgproto %s/%s=%s" % (build.build_lib,
self.distribution.packages[0], self.distribution.packages[0],
self.distribution.packages[0])),"\012") self.distribution.packages[0])),"\012")
except: except:
file_list=string.split( file_list=string.split(
getoutput("pkgproto %s=" % (build.build_lib)),"\012") getoutput("pkgproto %s=" % (build.build_lib)),"\012")
ownership="%s %s" % (pwd.getpwuid(os.getuid())[0], ownership="%s %s" % (pwd.getpwuid(os.getuid())[0],
grp.getgrgid(os.getgid())[0]) grp.getgrgid(os.getgid())[0])
for i in range(len(file_list)): for i in range(len(file_list)):
file_list[i] = string.replace(file_list[i],ownership,"root bin") file_list[i] = string.replace(file_list[i],ownership,"root bin")
@ -324,7 +324,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
# script with the autorelocation script. If no script is provided, # script with the autorelocation script. If no script is provided,
# The request script will simply be the autorelocate script # The request script will simply be the autorelocate script
if self.no_autorelocate==0: if self.no_autorelocate==0:
request=string.split(DEFAULT_REQUEST,"\012") request=string.split(DEFAULT_REQUEST,"\012")
else: else:
self.announce('Creating relocation request script') self.announce('Creating relocation request script')
if self.request: if self.request:
@ -334,7 +334,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
users_request.remove(users_request[0]) users_request.remove(users_request[0])
for i in users_request: for i in users_request:
request.append(i) request.append(i)
if self.no_autorelocate==0: if self.no_autorelocate==0:
request.append("#############################################") request.append("#############################################")
request.append("# finalize relocation support #") request.append("# finalize relocation support #")
@ -355,12 +355,12 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
'PSTAMP="%s"' % self.revision, 'PSTAMP="%s"' % self.revision,
] ]
info_file.extend(['VENDOR="%s (%s)"' % (self.distribution.maintainer, \ info_file.extend(['VENDOR="%s (%s)"' % (self.distribution.maintainer, \
self.distribution.license) ]) self.distribution.license) ])
info_file.extend(['EMAIL="%s"' % self.distribution.maintainer_email ]) info_file.extend(['EMAIL="%s"' % self.distribution.maintainer_email ])
p = self.distribution.get_platforms() p = self.distribution.get_platforms()
if p is None or p==['UNKNOWN']: if p is None or p==['UNKNOWN']:
archs=getoutput('uname -p') archs=getoutput('uname -p')
else: else:
archs=string.join(self.distribution.get_platforms(),',') archs=string.join(self.distribution.get_platforms(),',')
#else: #else:
@ -381,7 +381,7 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
break break
if site: if site:
info_file.extend(['BASEDIR="%s"' % site ]) info_file.extend(['BASEDIR="%s"' % site ])
return info_file return info_file
# _make_info_file () # _make_info_file ()
@ -400,11 +400,11 @@ class bdist_pkgtool (bdist_packager.bdist_packager):
new_changelog.append(line) new_changelog.append(line)
else: else:
new_changelog.append(' ' + line) new_changelog.append(' ' + line)
# strip trailing newline inserted by first changelog entry # strip trailing newline inserted by first changelog entry
if not new_changelog[0]: if not new_changelog[0]:
del new_changelog[0] del new_changelog[0]
return new_changelog return new_changelog
# _format_changelog() # _format_changelog()