aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2010-07-01 15:59:14 +0300
committerPriit Laes <plaes@plaes.org>2010-07-01 23:50:39 +0300
commit82728a88d59ceab0e78b002ed6896a339d4f1319 (patch)
tree2c574c05db002fe02ebade0955122e3e6b2311ad
parentMove session and db engine code into grumpy.database (diff)
downloadgsoc2010-grumpy-82728a88d59ceab0e78b002ed6896a339d4f1319.tar.gz
gsoc2010-grumpy-82728a88d59ceab0e78b002ed6896a339d4f1319.tar.bz2
gsoc2010-grumpy-82728a88d59ceab0e78b002ed6896a339d4f1319.zip
Port to OptionParser
-rwxr-xr-xutils/grumpy_sync.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/grumpy_sync.py b/utils/grumpy_sync.py
index 20c4674..3de226f 100755
--- a/utils/grumpy_sync.py
+++ b/utils/grumpy_sync.py
@@ -4,13 +4,12 @@ import os, sys
from datetime import datetime
from fnmatch import fnmatch
+from optparse import OptionParser
+
from pkgcore.config import load_config
from pkgcore.cache import metadata
from pkgcore.ebuild import repository
-from sqlalchemy import create_engine
-from sqlalchemy.orm import scoped_session, sessionmaker
-
from snakeoil.fileutils import iter_read_bash
path = os.path.join(os.path.dirname(__file__), os.path.pardir)
@@ -202,7 +201,11 @@ def main(path):
package_update(cat, pkg, files, int(os.stat(dir).st_mtime))
if __name__ == '__main__':
- if len(sys.argv) != 2:
- print "Please provide path to portage directory as argument"
- sys.exit()
- main(sys.argv[1])
+ parser = OptionParser(usage="usage: %prog [options] portagedir")
+ parser.add_option("-i", "--initial-sync", action="store_true", \
+ dest="initial", help="Skips handling of package moves")
+ (opts, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.error("please provide path to portagedir as first argument")
+ sys.exit(1)
+ main(args[0])