From: Brian Warner Date: Wed, 16 Jan 2008 07:08:51 +0000 (-0700) Subject: cli scripts: remove the for-educational-purposes standalone clauses. Closes #261. X-Git-Url: https://git.rkrishnan.org/specifications/index.php?a=commitdiff_plain;h=4cdb252d5a163d0693311dee5289ac566ec6977c;p=tahoe-lafs%2Ftahoe-lafs.git cli scripts: remove the for-educational-purposes standalone clauses. Closes #261. --- diff --git a/src/allmydata/scripts/tahoe_get.py b/src/allmydata/scripts/tahoe_get.py index 8c4b60bf..bae69acf 100644 --- a/src/allmydata/scripts/tahoe_get.py +++ b/src/allmydata/scripts/tahoe_get.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python import urllib @@ -25,29 +24,3 @@ def get(nodeurl, dir_uri, vdrive_fname, local_file, stdout, stderr): outf.close() return 0 - - -def main(): - import optparse, re - parser = optparse.OptionParser() - parser.add_option("-u", "--nodeurl", dest="nodeurl") - parser.add_option("-r", "--dir-cap", dest="rooturi") - - (options, args) = parser.parse_args() - - NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?") - if not isinstance(options.nodeurl, basestring) or not NODEURL_RE.match(options.nodeurl): - raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) - - if not options.rooturi: - raise ValueError("must provide --dir-cap") - - vdrive_fname = args[0] - local_file = None - if len(args) > 1: - local_file = args[1] - - get(options.nodeurl, options.rooturi, vdrive_fname, local_file) - -if __name__ == '__main__': - main() diff --git a/src/allmydata/scripts/tahoe_ls.py b/src/allmydata/scripts/tahoe_ls.py index 025e14f4..f6dc0f98 100644 --- a/src/allmydata/scripts/tahoe_ls.py +++ b/src/allmydata/scripts/tahoe_ls.py @@ -1,4 +1,3 @@ -#! /usr/bin/python import urllib import simplejson @@ -27,29 +26,3 @@ def list(nodeurl, dir_uri, vdrive_pathname, stdout, stderr): print >>stdout, "%10s %s" % (size, name) elif nodetype == "filenode": print >>stdout, "%10s %s" % (d['size'], vdrive_pathname) - - - -def main(): - import optparse, re - parser = optparse.OptionParser() - parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--dir-cap", dest="rooturi") - - (options, args) = parser.parse_args() - - NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?") - if not isinstance(options.nodeurl, basestring) or not NODEURL_RE.match(options.nodeurl): - raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) - - if not options.rooturi: - raise ValueError("must provide --dir-cap") - - vdrive_pathname = "" - if args: - vdrive_pathname = args[0] - - list(options.nodeurl, options.rooturi, vdrive_pathname) - -if __name__ == '__main__': - main() diff --git a/src/allmydata/scripts/tahoe_mv.py b/src/allmydata/scripts/tahoe_mv.py index be097a88..7b21a600 100644 --- a/src/allmydata/scripts/tahoe_mv.py +++ b/src/allmydata/scripts/tahoe_mv.py @@ -1,4 +1,3 @@ -#! /usr/bin/python import re import urllib diff --git a/src/allmydata/scripts/tahoe_put.py b/src/allmydata/scripts/tahoe_put.py index c81ec9c2..9febf50e 100644 --- a/src/allmydata/scripts/tahoe_put.py +++ b/src/allmydata/scripts/tahoe_put.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python import urllib from allmydata.scripts.common_http import do_http @@ -26,28 +25,3 @@ def put(nodeurl, dir_uri, local_fname, vdrive_fname, verbosity, print >>stderr, "error, got %s %s" % (resp.status, resp.reason) print >>stderr, resp.read() return 1 - -def main(): - import optparse, re - parser = optparse.OptionParser() - parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--dir-cap", dest="rooturi") - - (options, args) = parser.parse_args() - - NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?") - if not isinstance(options.nodeurl, basestring) or not NODEURL_RE.match(options.nodeurl): - raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) - - if not options.rooturi: - raise ValueError("must provide --dir-cap") - - local_file = args[0] - vdrive_fname = None - if len(args) > 1: - vdrive_fname = args[1] - - return put(options.nodeurl, options.rooturi, vdrive_fname, local_file) - -if __name__ == '__main__': - main() diff --git a/src/allmydata/scripts/tahoe_rm.py b/src/allmydata/scripts/tahoe_rm.py index d9106f3a..7f36d928 100644 --- a/src/allmydata/scripts/tahoe_rm.py +++ b/src/allmydata/scripts/tahoe_rm.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python import urllib from allmydata.scripts.common_http import do_http @@ -24,25 +23,3 @@ def rm(nodeurl, dir_uri, vdrive_pathname, verbosity, stdout, stderr): print >>stderr, "error, got %s %s" % (resp.status, resp.reason) print >>stderr, resp.read() return 1 - -def main(): - import optparse, re - parser = optparse.OptionParser() - parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--dir-cap", dest="rooturi") - - (options, args) = parser.parse_args() - - NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?") - if not isinstance(options.nodeurl, basestring) or not NODEURL_RE.match(options.nodeurl): - raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) - - if not options.rooturi: - raise ValueError("must provide --dir-cap") - - vdrive_pathname = args[0] - - return rm(options.nodeurl, options.rooturi, vdrive_pathname, 0) - -if __name__ == '__main__': - main()