Mercurial > cgi-bin > hgweb.cgi > tincan
comparison tincan.py @ 68:61667621e19d draft
Work around bug in py_compile.
author | David Barts <n5jrn@me.com> |
---|---|
date | Mon, 15 Jul 2019 00:15:25 -0700 |
parents | b5e72129ef72 |
children | c168aad7a731 |
comparison
equal
deleted
inserted
replaced
67:b5e72129ef72 | 68:61667621e19d |
---|---|
704 pyctime = self._gettime(pycpath) | 704 pyctime = self._gettime(pycpath) |
705 try: | 705 try: |
706 if pyctime < pytime: | 706 if pyctime < pytime: |
707 py_compile.compile(pypath, cfile=pycpath, doraise=True) | 707 py_compile.compile(pypath, cfile=pycpath, doraise=True) |
708 except py_compile.PyCompileError as e: | 708 except py_compile.PyCompileError as e: |
709 raise TinCanError(str(e)) from e | 709 msg = str(e) |
710 if pypath not in msg: | |
711 msg = pypath + ": " + msg | |
712 raise TinCanError(msg) from e | |
710 except Exception as e: | 713 except Exception as e: |
711 raise TinCanError("{0}: {1!s}".format(pypath, e)) from e | 714 raise TinCanError("{0}: {1!s}".format(pypath, e)) from e |
712 try: | 715 try: |
713 spec = importlib.util.spec_from_file_location(_mangle(self._name), pycpath) | 716 spec = importlib.util.spec_from_file_location(_mangle(self._name), pycpath) |
714 mod = importlib.util.module_from_spec(spec) | 717 mod = importlib.util.module_from_spec(spec) |