Force update the cache.
(self)
| 855 | break |
| 856 | |
| 857 | def cache_flush(self): |
| 858 | """ |
| 859 | Force update the cache. |
| 860 | """ |
| 861 | if not self._cache_path: |
| 862 | return |
| 863 | # TODO: don't write if the cache doesn't change |
| 864 | self.dist_log("write cache to path ->", self._cache_path) |
| 865 | cdict = self.__dict__.copy() |
| 866 | for attr in self.__dict__.keys(): |
| 867 | if re.match(self._cache_ignore, attr): |
| 868 | cdict.pop(attr) |
| 869 | |
| 870 | d = os.path.dirname(self._cache_path) |
| 871 | if not os.path.exists(d): |
| 872 | os.makedirs(d) |
| 873 | |
| 874 | repr_dict = pprint.pformat(cdict, compact=True) |
| 875 | with open(self._cache_path, "w") as f: |
| 876 | f.write(textwrap.dedent("""\ |
| 877 | # AUTOGENERATED DON'T EDIT |
| 878 | # Please make changes to the code generator \ |
| 879 | (distutils/ccompiler_opt.py) |
| 880 | hash = {} |
| 881 | data = \\ |
| 882 | """).format(self._cache_hash)) |
| 883 | f.write(repr_dict) |
| 884 | |
| 885 | def cache_hash(self, *factors): |
| 886 | # is there a built-in non-crypto hash? |