fix mistake in RELEASE.txt content
[scons.git] / site_scons / Utilities.py
blob7ef45a33c66883642331c392ff08ba44dc59ef4a
1 # SPDX-License-Identifier: MIT
3 # Copyright The SCons Foundation
5 import os
6 import stat
7 import time
8 import sysconfig
10 platform = sysconfig.get_platform()
12 def is_windows() -> bool:
13 """Check if we're on a Windows platform"""
14 return platform.startswith('win')
17 def whereis(filename):
18 """
19 An internal "whereis" routine to figure out if a given program
20 is available on this system.
21 """
22 exts = ['']
23 if is_windows():
24 exts += ['.exe']
25 for dir in os.environ['PATH'].split(os.pathsep):
26 f = os.path.join(dir, filename)
27 for ext in exts:
28 f_ext = f + ext
29 if os.path.isfile(f_ext):
30 try:
31 st = os.stat(f_ext)
32 except:
33 continue
34 if stat.S_IMODE(st[stat.ST_MODE]) & 0o111:
35 return f_ext
36 return None
39 # Datestring for debian
40 # Should look like: Mon, 03 Nov 2016 13:37:42 -0700
41 deb_date = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())