Author: hwright
Date: Tue Jul 26 21:04:41 2011
New Revision: 1151244
URL: http://svn.apache.org/viewvc?rev=1151244&view=rev
Log:
release.py: Add a couple of defaults in the parser, rather than a
subcommand handler.
* tools/dist/release.py
(post_candidates): Use the provided args directly.
(main): Provide default values for a couple of arguments here.
Modified:
subversion/trunk/tools/dist/release.py
Modified: subversion/trunk/tools/dist/release.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1151244&r1=1151243&r2=1151244&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Tue Jul 26 21:04:41 2011
@@ -442,19 +442,8 @@ def roll_tarballs(args):
def post_candidates(args):
'Post the generated tarballs to web-accessible directory.'
- if args.target:
- target = args.target
- else:
- target = os.path.join(os.getenv('HOME'), 'public_html', 'svn',
- str(args.version))
-
- if args.code_name:
- dirname = args.code_name
- else:
- dirname = 'deploy'
-
- if not os.path.exists(target):
- os.makedirs(target)
+ if not os.path.exists(args.target):
+ os.makedirs(args.target)
data = { 'version' : str(args.version),
'revnum' : args.revnum,
@@ -472,12 +461,13 @@ def post_candidates(args):
template = ezt.Template()
template.parse(get_tmplfile(template_filename).read())
- template.generate(open(os.path.join(target, 'index.html'), 'w'), data)
+ template.generate(open(os.path.join(args.target, 'index.html'), 'w'), data)
- logging.info('Moving tarballs to %s' % os.path.join(target, dirname))
- if os.path.exists(os.path.join(target, dirname)):
- shutil.rmtree(os.path.join(target, dirname))
- shutil.copytree(get_deploydir(args.base_dir), os.path.join(target,
dirname))
+ logging.info('Moving tarballs to %s' % os.path.join(args.target, dirname))
+ if os.path.exists(os.path.join(args.target, dirname)):
+ shutil.rmtree(os.path.join(args.target, dirname))
+ shutil.copytree(get_deploydir(args.base_dir),
+ os.path.join(args.target, dirname))
#----------------------------------------------------------------------
@@ -624,10 +614,13 @@ def main():
subparser.add_argument('revnum', type=int,
help='''The revision number to base the release on.''')
subparser.add_argument('--target',
- help='''The full path to the destination.''')
+ help='''The full path to the destination.''',
+ default=os.path.join(os.getenv('HOME'), 'public_html',
+ 'svn', str(args.version)))
subparser.add_argument('--code-name',
help='''A whimsical name for the release, used only for
- naming the download directory.''')
+ naming the download directory.''',
+ default='deploy')
# The clean-dist subcommand
subparser = subparsers.add_parser('clean-dist',