Browse code

2007-03-26 Michal Ludvig <michal@logix.cz>

* setup.py, S3/PkgInfo.py: Move package info out of setup.py
* s3cmd: new parameter --version



git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@106 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2007/03/26 09:18:24
Showing 4 changed files
... ...
@@ -1,5 +1,7 @@
1 1
 2007-03-26  Michal Ludvig  <michal@logix.cz>
2 2
 
3
+	* setup.py, S3/PkgInfo.py: Move package info out of setup.py
4
+	* s3cmd: new parameter --version
3 5
 	* s3cmd, S3/S3Uri.py: Output public HTTP URL for objects
4 6
 	  stored with Public ACL.
5 7
 	  
6 8
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+package = "s3cmd"
1
+version = "0.9.1"
2
+url = "http://s3tools.logix.cz"
3
+license = "GPL version 2"
4
+short_description = "S3cmd is a tool for managing Amazon S3 storage space."
5
+long_description = """
6
+S3cmd lets you copy files from/to Amazon S3 
7
+(Simple Storage Service) using a simple to use
8
+command line client.
9
+"""
10
+
... ...
@@ -18,6 +18,7 @@ import elementtree.ElementTree as ET
18 18
 from S3.S3 import *
19 19
 from S3.Config import Config
20 20
 from S3.S3Uri import *
21
+import S3.PkgInfo
21 22
 
22 23
 def output(message):
23 24
 	print message
... ...
@@ -120,7 +121,7 @@ def cmd_object_put(args):
120 120
 		error("Alternatively use --force argument and the specified")
121 121
 		error("object name will be prefixed to all stored filenames.")
122 122
 		sys.exit(1)
123
-
123
+	
124 124
 	for file in files:
125 125
 		uri_arg_final = str(uri)
126 126
 		if len(files) > 1 or uri.object() == "":
... ...
@@ -269,11 +270,11 @@ if __name__ == '__main__':
269 269
 	default_verbosity = Config().verbosity
270 270
 	optparser = OptionParser(option_class=OptionMimeType, formatter=MyHelpFormatter())
271 271
 	#optparser.disable_interspersed_args()
272
+
272 273
 	optparser.set_defaults(config=os.getenv("HOME")+"/.s3cfg")
273
-	optparser.add_option("-c", "--config", dest="config", metavar="FILE", help="Config file name. Defaults to %default")
274 274
 	optparser.set_defaults(verbosity = default_verbosity)
275
-	optparser.add_option("-d", "--debug", dest="verbosity", action="store_const", const=logging.DEBUG, help="Enable debug output.")
276
-	optparser.add_option("-v", "--verbose", dest="verbosity", action="store_const", const=logging.INFO, help="Enable verbose output.")
275
+
276
+	optparser.add_option("-c", "--config", dest="config", metavar="FILE", help="Config file name. Defaults to %default")
277 277
 	optparser.add_option("-H", "--human-readable-sizes", dest="human_readable_sizes", action="store_true", help="Print sizes in human readable form.")
278 278
 	optparser.add_option("-f", "--force", dest="force", action="store_true", help="Force overwrite and other dangerous operations.")
279 279
 	optparser.add_option("-u", "--show-uri", dest="show_uri", action="store_true", help="Show complete S3 URI in listings.")
... ...
@@ -282,6 +283,9 @@ if __name__ == '__main__':
282 282
 	optparser.add_option("-M", "--guess-mime-type", dest="guess_mime_type", action="store_true", help="Guess MIME-type of files by their extension. Falls back to default MIME-Type as specified by --mime-type option")
283 283
 	optparser.add_option(      "--dump-config", dest="dump_config", action="store_true", help="Dump current configuration after parsin config files and command line options and exit.")
284 284
 	optparser.add_option(      "--configure", dest="run_configure", action="store_true", help="Invoke interactive (re)configuration tool.")
285
+	optparser.add_option("-d", "--debug", dest="verbosity", action="store_const", const=logging.DEBUG, help="Enable debug output.")
286
+	optparser.add_option("-v", "--verbose", dest="verbosity", action="store_const", const=logging.INFO, help="Enable verbose output.")
287
+	optparser.add_option(      "--version", dest="show_version", action="store_true", help="Show s3cmd version (%s) and exit." % (S3.PkgInfo.version))
285 288
 
286 289
 	optparser.set_usage(optparser.usage + " COMMAND [parameters]")
287 290
 	optparser.set_description('S3cmd is a tool to manage objects in '+
... ...
@@ -289,7 +293,7 @@ if __name__ == '__main__':
289 289
 		'"buckets" and uploading, downloading and removing '+
290 290
 		'"objects" from these buckets.')
291 291
 	optparser.epilog = format_commands(optparser.get_prog_name())
292
-	optparser.epilog += '\nSee program homepage for more information at\nhttp://www.logix.cz/michal/devel/s3tools\n'
292
+	optparser.epilog += ("\nSee program homepage for more information at\n%s\n" % S3.PkgInfo.url)
293 293
 
294 294
 	(options, args) = optparser.parse_args()
295 295
 
... ...
@@ -297,6 +301,10 @@ if __name__ == '__main__':
297 297
 	## debugging/verbose output for config file parser on request
298 298
 	logging.basicConfig(level=options.verbosity, format='%(levelname)s: %(message)s')
299 299
 	
300
+	if options.show_version:
301
+		output("s3cmd version %s" % S3.PkgInfo.version)
302
+		sys.exit(0)
303
+
300 304
 	## Now finally parse the config file
301 305
 	try:
302 306
 		cfg = Config(options.config)
... ...
@@ -1,14 +1,17 @@
1 1
 from distutils.core import setup
2 2
 import os
3 3
 
4
+import S3.PkgInfo
5
+
4 6
 try:
5 7
 	os.unlink("MANIFEST")
6 8
 except:
7 9
 	pass
8 10
 
9
-setup(name = "s3cmd",
11
+setup(
10 12
 	## Content description
11
-	version = "0.9.1",
13
+	name = S3.PkgInfo.package,
14
+	version = S3.PkgInfo.version,
12 15
 	packages = [ 'S3' ],
13 16
 	scripts = ['s3cmd'],
14 17
 	data_files = [ ("share/s3cmd", [ "README", "INSTALL", "NEWS" ]), ],
... ...
@@ -16,16 +19,14 @@ setup(name = "s3cmd",
16 16
 	## Packaging details
17 17
 	author = "Michal Ludvig",
18 18
 	author_email = "michal@logix.cz",
19
-	url = 'http://s3tools.sourceforge.net',
20
-	license = 'GPL version 2',
21
-	description = 'S3cmd is a tool for managing your Amazon S3 storage.',
19
+	url = S3.PkgInfo.url,
20
+	license = S3.PkgInfo.license,
21
+	description = S3.PkgInfo.short_description,
22 22
 	long_description = """
23
-S3cmd lets you copy files from/to Amazon S3 
24
-(Simple Storage Service) using a simple to use
25
-command line client.
23
+%s
26 24
 
27 25
 Authors:
28 26
 --------
29
-    Michal Ludvig <michal@logix.cz>
30
-""",
27
+    Michal Ludvig  <michal@logix.cz>
28
+""" % (S3.PkgInfo.long_description)
31 29
 	)