Returns the minimum path modification timestamp resolution supported by the used Boost Jam executable.
(self)
| 835 | self.__wait_for_time_change(path, touch, last_build_time=False) |
| 836 | |
| 837 | def __build_timestamp_resolution(self): |
| 838 | """ |
| 839 | Returns the minimum path modification timestamp resolution supported |
| 840 | by the used Boost Jam executable. |
| 841 | |
| 842 | """ |
| 843 | dir = tempfile.mkdtemp("bjam_version_info") |
| 844 | try: |
| 845 | jam_script = "timestamp_resolution.jam" |
| 846 | f = open(os.path.join(dir, jam_script), "w") |
| 847 | try: |
| 848 | f.write("EXIT $(JAM_TIMESTAMP_RESOLUTION) : 0 ;") |
| 849 | finally: |
| 850 | f.close() |
| 851 | p = subprocess.Popen([self.program[0], "-d0", "-f%s" % jam_script], |
| 852 | stdout=subprocess.PIPE, cwd=dir, universal_newlines=True) |
| 853 | out, err = p.communicate() |
| 854 | finally: |
| 855 | shutil.rmtree(dir, ignore_errors=False) |
| 856 | |
| 857 | if p.returncode != 0: |
| 858 | raise TestEnvironmentError("Unexpected return code (%s) when " |
| 859 | "detecting Boost Jam's minimum supported path modification " |
| 860 | "timestamp resolution version information." % p.returncode) |
| 861 | if err: |
| 862 | raise TestEnvironmentError("Unexpected error output (%s) when " |
| 863 | "detecting Boost Jam's minimum supported path modification " |
| 864 | "timestamp resolution version information." % err) |
| 865 | |
| 866 | r = re.match("([0-9]{2}):([0-9]{2}):([0-9]{2}\\.[0-9]{9})$", out) |
| 867 | if not r: |
| 868 | # Older Boost Jam versions did not report their minimum supported |
| 869 | # path modification timestamp resolution and did not actually |
| 870 | # support path modification timestamp resolutions finer than 1 |
| 871 | # second. |
| 872 | # TODO: Phase this support out to avoid such fallback code from |
| 873 | # possibly covering up other problems. |
| 874 | return 1 |
| 875 | if r.group(1) != "00" or r.group(2) != "00": # hours, minutes |
| 876 | raise TestEnvironmentError("Boost Jam with too coarse minimum " |
| 877 | "supported path modification timestamp resolution (%s:%s:%s)." |
| 878 | % (r.group(1), r.group(2), r.group(3))) |
| 879 | return float(r.group(3)) # seconds.nanoseconds |
| 880 | |
| 881 | def __ensure_newer_than_last_build(self, path): |
| 882 | """ |
no test coverage detected