@@ -0,0 +1,2001 @@
+#!/usr/bin/env python%0A# Tai Sakuma %3Ctai.sakuma@gmail.com%3E%0Aimport os, sys%0Aimport argparse%0Aimport tarfile%0Aimport gzip%0A%0Atry:%0A    import cPickle as pickle%0Aexcept:%0A    import pickle%0A%0A##__________________________________________________________________%7C%7C%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument('path', nargs=1, help='path to pickle')%0Aargs = parser.parse_args()%0A%0A##__________________________________________________________________%7C%7C%0Adef main():%0A%0A    cwd = os.getcwd()%0A    workingarea_path = os.path.dirname(args.path%5B0%5D)%0A    pickle_basename = os.path.basename(args.path%5B0%5D)%0A%0A    setup(cwd, workingarea_path)%0A%0A    run(cwd, workingarea_path, pickle_basename)%0A%0A##__________________________________________________________________%7C%7C%0Adef run(cwd, workingarea_path, pickle_basename):%0A%0A    os.chdir(workingarea_path)%0A%0A    with gzip.open(pickle_basename, 'rb') as f:%0A        reader = pickle.load(f)%0A%0A    os.chdir(cwd)%0A    reader.end()%0A%0A##__________________________________________________________________%7C%7C%0Adef setup(cwd, workingarea_path):%0A%0A    os.chdir(workingarea_path)%0A%0A    dirname = 'python_modules'%0A    tarname = dirname + '.tar.gz'%0A%0A    if os.path.exists(tarname) and not os.path.exists(dirname):%0A        if try_make_file('.untarring'):%0A            tar = tarfile.open(tarname)%0A            tar.extractall()%0A            tar.close()%0A            os.remove('.untarring')%0A%0A    while os.path.isfile('.untarring'):%0A       pass%0A%0A    if os.path.exists(dirname):%0A        sys.path.insert(0, dirname)%0A%0A    os.chdir(cwd)%0A%0A##__________________________________________________________________%7C%7C%0A# http://stackoverflow.com/questions/33223564/atomically-creating-a-file-if-it-doesnt-exist-in-python%0Adef try_make_file(filename):%0A    try:%0A        os.open(filename,  os.O_CREAT %7C os.O_EXCL)%0A        return True%0A    except OSError:%0A        # FileExistsError can be used for Python 3%0A        return False%0A%0A##__________________________________________________________________%7C%7C%0Aif __name__ == '__main__':%0A    main()%0A

copy resume.py from fwtwirl