From 229386ab942c20c6b5d9bdb3000713722ea1835d Mon Sep 17 00:00:00 2001
From: "Zooko O'Whielacronx zooko@zooko.com" <zooko@zooko.com>
Date: Sun, 15 Apr 2007 01:24:51 +0530
Subject: [PATCH] pyfec: fix up docs, version numbers, bump version to
 1.0.0a1-0-STABLE

darcs-hash:4f671c38a25c57509dc225a77fd97e6a4b39c941
---
 pyfec/README.txt      | 22 ++++++++++++++++------
 pyfec/bin/fec         | 12 ++++++++++--
 pyfec/bin/unfec       | 11 ++++++++++-
 pyfec/fec/__init__.py |  2 +-
 pyfec/setup.py        |  6 +++---
 5 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/pyfec/README.txt b/pyfec/README.txt
index fc108a8..b8f70e1 100644
--- a/pyfec/README.txt
+++ b/pyfec/README.txt
@@ -18,8 +18,8 @@ This package is largely based on the old "fec" library by Luigi Rizzo et al.,
 which is a mature and optimized implementation of erasure coding.  The pyfec
 package makes several changes from the original "fec" package, including
 addition of the Python API, refactoring of the C API to support zero-copy
-operation, and a few clean-ups and micro-optimizations of the core code
-itself.
+operation, a few clean-ups and micro-optimizations of the core code itself, 
+and the addition of a command-line tool named "fec".
 
 
  * Community
@@ -73,6 +73,19 @@ encoding step.  The decoding step produces as output the data that was earlier
 input to the encoding step.
 
 
+ * Command-Line Tool
+
+The bin/ directory contains two Unix-style, command-line tools "fec" and 
+"unfec".  Execute "fec --help" or "unfec --help" for usage instructions.
+
+Note: a Unix-style tool like "fec" does only one thing -- in this case erasure 
+coding -- and leaves other tasks to other tools.  Other Unix-style tools that 
+go well with "fec" include "GNU tar" for packaging up multiple files and 
+directories into one bundle, "rzip" for compression, and "GNU Privacy Guard" 
+for encryption.  It is best to do things in that order: first package, then 
+compress, then encrypt, then erasure code.
+
+
  * API
 
 Each block is associated with "blocknum".  The blocknum of each primary block is
@@ -80,7 +93,7 @@ its index (starting from zero), so the 0'th block is the first primary block,
 which is the first few bytes of the file, the 1'st block is the next primary
 block, which is the next few bytes of the file, and so on.  The last primary
 block has blocknum k-1.  The blocknum of each secondary block is an arbitrary
-integer between k and 256 inclusive.  (When using the Python API, if you don't
+integer between k and 255 inclusive.  (When using the Python API, if you don't
 specify which blocknums you want for your secondary blocks when invoking
 encode(), then it will by default provide the blocks with ids from k to m-1
 inclusive.)
@@ -147,9 +160,6 @@ objects (e.g. Python strings) to hold the data that you pass to pyfec.
 The filefec.py module which has a utility function for efficiently reading a
 file and encoding it piece by piece.
 
-The bin/ directory contains two Unix-style, command-line tools "fec" and 
-"unfec".  See their usage strings for details.
-
 
  * Dependencies
 
diff --git a/pyfec/bin/fec b/pyfec/bin/fec
index 170933c..4b29862 100755
--- a/pyfec/bin/fec
+++ b/pyfec/bin/fec
@@ -5,10 +5,17 @@
 
 import sys
 
+import fec
 from fec.util import argparse
-
 from fec import filefec
-
+from fec.util.version import Version
+__version__ = Version("1.0.0a1-0-STABLE")
+
+if '-V' in sys.argv or '--version' in sys.argv:
+    print "pyfec library version: ", fec.__version__
+    print "fec command-line tool version: ", __version__
+    sys.exit(0)
+  
 parser = argparse.ArgumentParser(description="Encode a file into a set of share files, a subset of which can later be used to recover the original file.")
 
 parser.add_argument('inputfile', help='file to encode or "-" for stdin', type=argparse.FileType('rb'), metavar='INF')
@@ -18,6 +25,7 @@ parser.add_argument('-s', '--suffix', help='suffix for share file names', defaul
 parser.add_argument('-m', '--totalshares', help='the total number of share files created', default=16, metavar='M')
 parser.add_argument('-k', '--requiredshares', help='the number of share files required to reconstruct', default=4, metavar='K')
 parser.add_argument('-v', '--verbose', help='print out messages about progress', action='store_true')
+parser.add_argument('-V', '--version', help='print out version number and exit', action='store_true')
 args = parser.parse_args()
 
 if args.prefix is None:
diff --git a/pyfec/bin/unfec b/pyfec/bin/unfec
index 15a87ae..8ef5c1f 100755
--- a/pyfec/bin/unfec
+++ b/pyfec/bin/unfec
@@ -7,13 +7,22 @@ import sys
 
 from fec.util import argparse
 
+import fec
 from fec import filefec
-
+from fec.util.version import Version
+__version__ = Version("1.0.0a1-0-STABLE")
+
+if '-V' in sys.argv or '--version' in sys.argv:
+    print "pyfec library version: ", fec.__version__
+    print "fec command-line tool version: ", __version__
+    sys.exit(0)
+  
 parser = argparse.ArgumentParser(description="Decode data from share files.")
 
 parser.add_argument('outputfile', help='file to write the resulting data to, or "-" for stdout', type=argparse.FileType('wb'), metavar='OUTF')
 parser.add_argument('sharefiles', nargs='+', help='shares file to read the encoded data from', type=argparse.FileType('rb'), metavar='SHAREFILE')
 parser.add_argument('-v', '--verbose', help='print out messages about progress', action='store_true')
+parser.add_argument('-V', '--version', help='print out version number and exit', action='store_true')
 args = parser.parse_args()
 
 if len(args.sharefiles) < 2:
diff --git a/pyfec/fec/__init__.py b/pyfec/fec/__init__.py
index 1e3baaf..ddae766 100644
--- a/pyfec/fec/__init__.py
+++ b/pyfec/fec/__init__.py
@@ -10,7 +10,7 @@ from util.version import Version
 
 # For an explanation of what the parts of the version string mean,
 # please see pyutil.version.
-__version__ = Version("0.9.9-0-STABLE")
+__version__ = Version("1.0.0a1-0-STABLE")
 
 # Please put a URL or other note here which shows where to get the branch of
 # development from which this version grew.
diff --git a/pyfec/setup.py b/pyfec/setup.py
index 3081ef6..bd1321f 100755
--- a/pyfec/setup.py
+++ b/pyfec/setup.py
@@ -55,12 +55,12 @@ trove_classifiers=[
     ]
 
 setup(name='pyfec',
-      version='0.99',
+      version='1.0.0a1',
       summary='Provides a fast C implementation of Reed-Solomon erasure coding with a Python interface.',
-      description='Erasure coding is the generation of extra redundant packets of information such that if some packets are lost ("erased") then the original data can be recovered from the remaining packets.  This package contains an optimized implementation along with a Python interface.',
+      description='Erasure coding is the generation of redundant blocks of information such that if some blocks are lost ("erased") then the original data can be recovered from the remaining blocks.  This package contains an optimized implementation along with a Python interface.',
       author='Zooko O\'Whielacronx',
       author_email='zooko@zooko.com',
-      url='http://zooko.com/repos/pyfec',
+      url='http://www.allmydata.com/source/pyfec',
       license='GNU GPL',
       platform='Any',
       packages=['fec', 'fec.util', 'fec.test'],
-- 
2.45.2