|
150 | 150 | def WarnConflictingFiles(delete = False):
|
151 | 151 | for cfile in CONFLICTING_FILES:
|
152 | 152 | if os.path.exists(cfile):
|
153 |
| - print("%sWARNING:%s file may conflict with build: %s%s%s" % (GetColor("red"), GetColor(), GetColor("green"), cfile, GetColor())) |
| 153 | + Warn("file may conflict with build:", cfile) |
154 | 154 | if delete:
|
155 | 155 | os.unlink(cfile)
|
156 | 156 | print("Deleted.")
|
@@ -284,6 +284,20 @@ def exit(msg = ""):
|
284 | 284 | print(msg)
|
285 | 285 | raise "initiate-exit"
|
286 | 286 |
|
| 287 | +def Warn(msg, extra=None): |
| 288 | + if extra is not None: |
| 289 | + print("%sWARNING:%s %s %s%s%s" % (GetColor("red"), GetColor(), msg, GetColor("green"), extra, GetColor())) |
| 290 | + else: |
| 291 | + print("%sWARNING:%s %s" % (GetColor("red"), GetColor(), msg)) |
| 292 | + sys.stdout.flush() |
| 293 | + |
| 294 | +def Error(msg, extra=None): |
| 295 | + if extra is not None: |
| 296 | + print("%sERROR:%s %s %s%s%s" % (GetColor("red"), GetColor(), msg, GetColor("green"), extra, GetColor())) |
| 297 | + else: |
| 298 | + print("%sERROR:%s %s" % (GetColor("red"), GetColor(), msg)) |
| 299 | + exit() |
| 300 | + |
287 | 301 | ########################################################################
|
288 | 302 | ##
|
289 | 303 | ## SetTarget, GetTarget, GetHost
|
@@ -723,7 +737,7 @@ def NeedsBuild(files, others):
|
723 | 737 | print(" dependency changed: %s" % (key))
|
724 | 738 |
|
725 | 739 | if VERBOSE and frozenset(cached) != frozenset(dates):
|
726 |
| - print("%sWARNING:%s file dependencies changed: %s%s%s" % (GetColor("red"), GetColor(), GetColor("green"), files, GetColor())) |
| 740 | + Warn("file dependencies changed:", files) |
727 | 741 |
|
728 | 742 | return True
|
729 | 743 |
|
@@ -1298,7 +1312,7 @@ def GetThirdpartyDir():
|
1298 | 1312 | THIRDPARTYDIR = GetThirdpartyBase()+"/android-libs-%s/" % (GetTargetArch())
|
1299 | 1313 |
|
1300 | 1314 | else:
|
1301 |
| - print("%s Unsupported platform: %s" % (ColorText("red", "WARNING:"), target)) |
| 1315 | + Warn("Unsupported platform:", target) |
1302 | 1316 | return
|
1303 | 1317 |
|
1304 | 1318 | if (GetVerbose()):
|
@@ -1744,11 +1758,10 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
1744 | 1758 | if not custom_loc and pkgconfig is not None and not libs:
|
1745 | 1759 | # pkg-config is all we can do, abort if it wasn't found.
|
1746 | 1760 | if pkg in PkgListGet():
|
1747 |
| - print("%sWARNING:%s Could not locate pkg-config package %s, excluding from build" % (GetColor("red"), GetColor(), pkgconfig)) |
| 1761 | + Warn("Could not locate pkg-config package %s, excluding from build" % (pkgconfig)) |
1748 | 1762 | PkgDisable(pkg)
|
1749 | 1763 | else:
|
1750 |
| - print("%sERROR:%s Could not locate pkg-config package %s, aborting build" % (GetColor("red"), GetColor(), pkgconfig)) |
1751 |
| - exit() |
| 1764 | + Error("Could not locate pkg-config package %s, aborting build" % (pkgconfig)) |
1752 | 1765 |
|
1753 | 1766 | else:
|
1754 | 1767 | # Okay, our pkg-config attempts failed. Let's try locating the libs by ourselves.
|
@@ -1812,14 +1825,12 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
1812 | 1825 |
|
1813 | 1826 | if not have_pkg:
|
1814 | 1827 | if custom_loc:
|
1815 |
| - print("%sERROR:%s Could not locate thirdparty package %s in specified directory, aborting build" % (GetColor("red"), GetColor(), pkg.lower())) |
1816 |
| - exit() |
| 1828 | + Error("Could not locate thirdparty package %s in specified directory, aborting build" % (pkg.lower())) |
1817 | 1829 | elif pkg in PkgListGet():
|
1818 |
| - print("%sWARNING:%s Could not locate thirdparty package %s, excluding from build" % (GetColor("red"), GetColor(), pkg.lower())) |
| 1830 | + Warn("Could not locate thirdparty package %s, excluding from build" % (pkg.lower())) |
1819 | 1831 | PkgDisable(pkg)
|
1820 | 1832 | else:
|
1821 |
| - print("%sERROR:%s Could not locate thirdparty package %s, aborting build" % (GetColor("red"), GetColor(), pkg.lower())) |
1822 |
| - exit() |
| 1833 | + Error("Could not locate thirdparty package %s, aborting build" % (pkg.lower())) |
1823 | 1834 |
|
1824 | 1835 | ########################################################################
|
1825 | 1836 | ##
|
@@ -2100,7 +2111,7 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
2100 | 2111 | os.environ["PYTHONHOME"] = SDK["PYTHON"]
|
2101 | 2112 |
|
2102 | 2113 | if sys.version[:3] != ver:
|
2103 |
| - print("Warning: running makepanda with Python %s, but building Panda3D with Python %s." % (sys.version[:3], ver)) |
| 2114 | + Warn("running makepanda with Python %s, but building Panda3D with Python %s." % (sys.version[:3], ver)) |
2104 | 2115 |
|
2105 | 2116 | elif CrossCompiling() or (prefer_thirdparty_python and os.path.isdir(os.path.join(GetThirdpartyDir(), "python"))):
|
2106 | 2117 | tp_python = os.path.join(GetThirdpartyDir(), "python")
|
@@ -2743,12 +2754,11 @@ def LibName(opt, name):
|
2743 | 2754 | WARNINGS.append(name + " not found. Skipping Package " + opt)
|
2744 | 2755 | if (opt in PkgListGet()):
|
2745 | 2756 | if not PkgSkip(opt):
|
2746 |
| - print("%sWARNING:%s Could not locate thirdparty package %s, excluding from build" % (GetColor("red"), GetColor(), opt.lower())) |
| 2757 | + Warn("Could not locate thirdparty package %s, excluding from build" % (opt.lower())) |
2747 | 2758 | PkgDisable(opt)
|
2748 | 2759 | return
|
2749 | 2760 | else:
|
2750 |
| - print("%sERROR:%s Could not locate thirdparty package %s, aborting build" % (GetColor("red"), GetColor(), opt.lower())) |
2751 |
| - exit() |
| 2761 | + Error("Could not locate thirdparty package %s, aborting build" % (opt.lower())) |
2752 | 2762 | LIBNAMES.append((opt, name))
|
2753 | 2763 |
|
2754 | 2764 | def DefSymbol(opt, sym, val=""):
|
@@ -2831,7 +2841,7 @@ def SetupBuildEnvironment(compiler):
|
2831 | 2841 |
|
2832 | 2842 | returnval = handle.close()
|
2833 | 2843 | if returnval != None and returnval != 0:
|
2834 |
| - print("%sWARNING:%s %s failed" % (GetColor("red"), GetColor(), cmd)) |
| 2844 | + Warn("%s failed" % (cmd)) |
2835 | 2845 | SYS_LIB_DIRS += [SDK.get("SYSROOT", "") + "/usr/lib"]
|
2836 | 2846 |
|
2837 | 2847 | # Now extract the preprocessor's include directories.
|
@@ -2860,7 +2870,7 @@ def SetupBuildEnvironment(compiler):
|
2860 | 2870 | print("Ignoring non-existent include directory %s" % (line))
|
2861 | 2871 |
|
2862 | 2872 | if handle.returncode != 0 or not SYS_INC_DIRS:
|
2863 |
| - print("%sWARNING:%s %s failed or did not produce the expected result" % (GetColor("red"), GetColor(), cmd)) |
| 2873 | + Warn("%s failed or did not produce the expected result" % (cmd)) |
2864 | 2874 | sysroot = SDK.get("SYSROOT", "")
|
2865 | 2875 | # Add some sensible directories as a fallback.
|
2866 | 2876 | SYS_INC_DIRS = [
|
@@ -3374,7 +3384,7 @@ def FindLocation(fn, ipath, pyabi=None):
|
3374 | 3384 |
|
3375 | 3385 | elif ext != ".pyd" and loc not in WARNED_FILES:
|
3376 | 3386 | WARNED_FILES.add(loc)
|
3377 |
| - print("%sWARNING:%s file depends on Python but is not in an ABI-specific directory: %s%s%s" % (GetColor("red"), GetColor(), GetColor("green"), loc, GetColor())) |
| 3387 | + Warn("file depends on Python but is not in an ABI-specific directory:", loc) |
3378 | 3388 |
|
3379 | 3389 | ORIG_EXT[loc] = ext
|
3380 | 3390 | return loc
|
|
0 commit comments