public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Cinnamon Shia <cinnamon.shia@hpe.com>
To: edk2-devel@lists.01.org
Subject: [PATCH v2] Edk2Setup.bat: Support building platforms with Python source
Date: Fri, 21 Oct 2016 15:41:21 +0800	[thread overview]
Message-ID: <20161021074121.6492-1-cinnamon.shia@hpe.com> (raw)

Following the same approach as toolsetup.bat:
If build.exe, TargetTool.exe, Trim.exe or GenFds.exe is missing, run its
Python source instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
---
 Edk2Setup.bat | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/Edk2Setup.bat b/Edk2Setup.bat
index 2d13234..68f46dc 100755
--- a/Edk2Setup.bat
+++ b/Edk2Setup.bat
@@ -27,6 +27,7 @@
 @REM     build.exe Version 0.51 Developer Build based on Revision: 15668
 @REM
 @REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 @REM This program and the accompanying materials
 @REM are licensed and made available under the terms and conditions of the BSD License
 @REM which accompanies this distribution.  The full text of the license may be found at
@@ -59,6 +60,7 @@
 @set SRC_CONF=
 @set ARGUMENT=
 @set SCRIPT=EDKSETUP_BAT
+@set PYTHON_BUILD=
 
 @if not defined ORIGINAL_PATH set "ORIGINAL_PATH=%PATH%"
 @REM Always set the WORKSPACE environment variable to the current directory
@@ -352,12 +354,7 @@
 
 @if defined REBUILD_TOOLS goto SetConf
 @if defined SVN_PULL goto SetConf
-@if not exist "%EDK_TOOLS_PATH%\Bin\Win32\build.exe" (
-    @echo ERROR : %EDK_TOOLS_PATH%\Bin\Win32\build.exe does not exist
-    @echo         Re-run this script using --reset, --pull or --rebuild
-    @echo.
-    @goto ExitFailure
-)
+
 @echo.
 @echo Rebuilding of the tools is not required. Binaries of the latest,
 @echo tested versions of the tools have been tested and included in the
@@ -416,6 +413,31 @@
 )
 @set "PATH=%EDK_TOOLS_BIN%;%PATH%"
 
+@if NOT EXIST "%EDK_TOOLS_BIN%\build.exe" @set PYTHON_BUILD=TRUE
+@if NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" @set PYTHON_BUILD=TRUE
+@if NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" @set PYTHON_BUILD=TRUE
+@if NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" @set PYTHON_BUILD=TRUE
+
+@if not defined PYTHON_BUILD goto SvnPull
+
+@echo  !!! WARNING !!! Setup environment to run Python scripts directly.
+
+@if not defined PYTHON_HOME (
+  @if defined PYTHONHOME (
+    @set PYTHON_HOME=%PYTHONHOME%
+  ) else (
+    @echo.
+    @echo  !!! ERROR !!! PYTHON_HOME is required to build or execute the tools, please set it. !!!
+    @echo.
+    @goto ExitFailure
+  )
+)
+
+@set PATH=%PATH%;%BASE_TOOLS_PATH%\BinWrappers\WindowsLike
+@set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
+@set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
+
+:SvnPull
 @if "%REBUILD_TOOLS%"=="TRUE" @goto Rebuild
 @if "%SVN_PULL%"== "TRUE" (
     if defined PYTHONHOME (
@@ -485,6 +507,7 @@
 @set SCRIPT=
 @set LIST_VS_VERSIONS=
 @set PYTHON_FREEZER_PATH=
+@set PYTHON_BUILD=
 @echo on
 @exit /B 0
 
@@ -504,5 +527,6 @@
 @set SCRIPT=
 @set LIST_VS_VERSIONS=
 @set PYTHON_FREEZER_PATH=
+@set PYTHON_BUILD=
 @echo on
 @exit /B 1
-- 
2.10.0.windows.1



             reply	other threads:[~2016-10-21  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  7:41 Cinnamon Shia [this message]
2016-10-24  2:47 ` [PATCH v2] Edk2Setup.bat: Support building platforms with Python source Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161021074121.6492-1-cinnamon.shia@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox