MCPcopy Create free account
hub / github.com/boostorg/build / __build_timestamp_resolution

Method __build_timestamp_resolution

v2/test/BoostBuild.py:835–877  ·  view source on GitHub ↗

Returns the minimum path modification timestamp resolution supported by the used Boost Jam executable.

(self)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

matchMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected