diff options
author | rahulp13 | 2020-03-03 05:38:24 +0530 |
---|---|---|
committer | rahulp13 | 2020-03-03 05:38:24 +0530 |
commit | 07cc7e03ba5e91c14abc854231ce975109563616 (patch) | |
tree | c00d44222bba1dc31a899987581ccebe1424a2c6 /Windows/dateutil/zoneinfo/rebuild.py | |
parent | dfc268e0863c913a1b8726cd54eea3b40caf7c67 (diff) | |
download | eSim-07cc7e03ba5e91c14abc854231ce975109563616.tar.gz eSim-07cc7e03ba5e91c14abc854231ce975109563616.tar.bz2 eSim-07cc7e03ba5e91c14abc854231ce975109563616.zip |
packaging with pyinstaller - Windows OS
Diffstat (limited to 'Windows/dateutil/zoneinfo/rebuild.py')
-rw-r--r-- | Windows/dateutil/zoneinfo/rebuild.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/Windows/dateutil/zoneinfo/rebuild.py b/Windows/dateutil/zoneinfo/rebuild.py deleted file mode 100644 index 78f0d1a0..00000000 --- a/Windows/dateutil/zoneinfo/rebuild.py +++ /dev/null @@ -1,53 +0,0 @@ -import logging -import os -import tempfile -import shutil -import json -from subprocess import check_call -from tarfile import TarFile - -from dateutil.zoneinfo import METADATA_FN, ZONEFILENAME - - -def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None): - """Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* - - filename is the timezone tarball from ``ftp.iana.org/tz``. - - """ - tmpdir = tempfile.mkdtemp() - zonedir = os.path.join(tmpdir, "zoneinfo") - moduledir = os.path.dirname(__file__) - try: - with TarFile.open(filename) as tf: - for name in zonegroups: - tf.extract(name, tmpdir) - filepaths = [os.path.join(tmpdir, n) for n in zonegroups] - try: - check_call(["zic", "-d", zonedir] + filepaths) - except OSError as e: - _print_on_nosuchfile(e) - raise - # write metadata file - with open(os.path.join(zonedir, METADATA_FN), 'w') as f: - json.dump(metadata, f, indent=4, sort_keys=True) - target = os.path.join(moduledir, ZONEFILENAME) - with TarFile.open(target, "w:%s" % format) as tf: - for entry in os.listdir(zonedir): - entrypath = os.path.join(zonedir, entry) - 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?") |