some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-05-28 15:47:25 +04:00
parent 220ec2fefd
commit 6dec27b3d5
2 changed files with 20 additions and 8 deletions

View File

@ -1,7 +1,7 @@
#=======================================================================
__version__ = '''0.0.01'''
__sub_version__ = '''20130525140732'''
__sub_version__ = '''20130528154633'''
__copyright__ = '''(c) Alex A. Naanou 2011'''
@ -13,6 +13,7 @@ import json
import sha
import urllib2
import time
from optparse import OptionParser, OptionGroup
from pli.logictypes import OR
@ -396,8 +397,13 @@ def build_cache(path, config=CONFIG, gid_generator=hash_gid,
#-----------------------------------------------------------------------
if __name__ == '__main__':
from optparse import OptionParser, OptionGroup
# Runtime...
#--------------------------------------------------handle_commandline---
def handle_commandline():
'''
Parse commandline args and act accordingly...
'''
res = None
parser = OptionParser(
usage='Usage: %prog [options] ROOT',
@ -545,7 +551,7 @@ if __name__ == '__main__':
report = make_inline_report_progress(progress_state)
# do the run...
build_cache(IN_PATH,
res = build_cache(IN_PATH,
config,
hash_gid,
report,
@ -558,6 +564,14 @@ if __name__ == '__main__':
print
print 'Time: %.1fm' % ((progress_state['done at'] - progress_state['started at'])/60)
return res
#-----------------------------------------------------------------------
if __name__ == '__main__':
handle_commandline()

View File

@ -1,7 +1,7 @@
#=======================================================================
__version__ = '''0.0.01'''
__sub_version__ = '''20130528153701'''
__sub_version__ = '''20130528154208'''
__copyright__ = '''(c) Alex A. Naanou 2011'''
@ -25,7 +25,7 @@ from pprint import pprint
#-----------------------------------------------------------------------
#----------------------------------------------------------build_dirs---
##!!! make this relative-path compatible...
##!!! make this figure out the path by itself...
def build_dirs(data, path, rewrite=None):
'''
rewrite can be:
@ -39,8 +39,6 @@ def build_dirs(data, path, rewrite=None):
# gen3
if version == '2.0':
##!!! get base path...
##!!!
img = data['image_file']
# absolute path...
if img.startswith('file:///'):