diff options
Diffstat (limited to 'dateutil/zoneinfo')
-rw-r--r-- | dateutil/zoneinfo/rebuild.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/dateutil/zoneinfo/rebuild.py b/dateutil/zoneinfo/rebuild.py index ff3bea0..a66c1d9 100644 --- a/dateutil/zoneinfo/rebuild.py +++ b/dateutil/zoneinfo/rebuild.py @@ -25,11 +25,7 @@ def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None): try: check_call(["zic", "-d", zonedir] + filepaths) except OSError as e: - if e.errno == 2: - logging.error( - "Could not find zic. Perhaps you need to install " - "libc-bin or some other package that provides it, " - "or it's not in your PATH?") + _print_on_nosuchfile(e) raise # write metadata file with open(os.path.join(zonedir, METADATA_FN), 'w') as f: @@ -41,3 +37,15 @@ def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None): tf.add(entrypath, entry) finally: shutil.rmtree(tmpdir) + +def _print_on_nosuchfile(e): + """Print helpful troubleshooting message + + e is an exception raised by subprocess.check_call() + + """ + if e.errno == 2: + logging.error( + "Could not find zic. Perhaps you need to install " + "libc-bin or some other package that provides it, " + "or it's not in your PATH?") |