public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Desimone, Ashley E" <ashley.e.desimone@intel.com>
To: "Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Pandya, Puja" <puja.pandya@intel.com>,
	"Bjorge, Erik C" <erik.c.bjorge@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: Re: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix PYTHON_VERSION usage
Date: Thu, 2 Jan 2020 19:25:52 +0000	[thread overview]
Message-ID: <4CF3A9EB60ABDA47BE7821A4DA3A0A3353CCB7BA@ORSMSX116.amr.corp.intel.com> (raw)
In-Reply-To: <20191227020521.9149-1-nathaniel.l.desimone@intel.com>

Reviewed-by:  Ashley DeSimone <ashley.e.desimone@intel.com>

-----Original Message-----
From: Desimone, Nathaniel L 
Sent: Thursday, December 26, 2019 6:05 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Desimone, Ashley E <ashley.e.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix PYTHON_VERSION usage

From: Nate DeSimone <nathaniel.l.desimone@intel.com>

PYTHON_VERSION in set_version_and_build_wheels.py is only being used for Windows right now. This patch adds Linux support.

Cc: Ashley DeSimone <ashley.e.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 build-scripts/set_version_and_build_wheels.py | 46 +++++++++----------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/build-scripts/set_version_and_build_wheels.py b/build-scripts/set_version_and_build_wheels.py
index 6fd5ab5..6d5b8d0 100755
--- a/build-scripts/set_version_and_build_wheels.py
+++ b/build-scripts/set_version_and_build_wheels.py
@@ -18,7 +18,7 @@ import re
 from subprocess import call, check_call  from xml.etree import ElementTree

-PYTHON_VERSION="-3"
+PYTHON_VERSION="3"

 #
 # Environment detection
@@ -38,13 +38,13 @@ elif os.name == "posix":
 else:
     raise EnvironmentError("Unsupported OS")

-setup_py_version_data = re.compile("\s*version='([\d.]+)',")
-assembly_file_version_data = re.compile("\s*\[\s*assembly:\s*AssemblyFileVersion\s*\(\"([\d.]+)\"\)\s*\]")
-version_number_data = re.compile("(\d+)\.(\d+)\.(\d+)\.(\d+)")
-file_version_data = re.compile("FILEVERSION\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)")
-product_version_data = re.compile("PRODUCTVERSION\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)")
-file_version_string_data = re.compile("\s*VALUE\s*\"FileVersion\"\s*,\s*\"([\d.]+)\"")
-product_version_string_data = re.compile("\s*VALUE\s*\"ProductVersion\"\s*,\s*\"([\d.]+)\"")
+setup_py_version_data = re.compile(r"\s*version='([\d.]+)',")
+assembly_file_version_data = 
+re.compile(r"\s*\[\s*assembly:\s*AssemblyFileVersion\s*\(\"([\d.]+)\"\)
+\s*\]") version_number_data = re.compile(r"(\d+)\.(\d+)\.(\d+)\.(\d+)")
+file_version_data = 
+re.compile(r"FILEVERSION\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)")
+product_version_data = 
+re.compile(r"PRODUCTVERSION\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)")
+file_version_string_data = 
+re.compile(r"\s*VALUE\s*\"FileVersion\"\s*,\s*\"([\d.]+)\"")
+product_version_string_data = 
+re.compile(r"\s*VALUE\s*\"ProductVersion\"\s*,\s*\"([\d.]+)\"")
 wheel_package = re.compile("^([^-]+)-")

 def get_current_version_number():
@@ -77,7 +77,7 @@ def set_version_number_setup_py(package_version):

 def set_version_number_assembly_info(version):
     assembly_info_files = []
-    for root, dirnames, filenames in os.walk(".."):
+    for root, _, filenames in os.walk(".."):
         for filename in filenames:
             if fnmatch.fnmatch(filename, "AssemblyInfo.cs"):
                 assembly_info_files.append(os.path.join(root, filename)) @@ -113,11 +113,11 @@ def _set_version_number_and_wheels_cr_tools_installer_config(package_version, wh
                                     present_wheels.append(found_wheel[0])
                     for found_wheel in wheels:
                         if found_wheel[0] not in present_wheels:
-                            new_element = ElementTree.SubElement(py_version, "Wheel",
-                                                                 {"Name": found_wheel[0],
-                                                                  "Path": found_wheel[1],
-                                                                  "Version": package_version,
-                                                                  "UninstallAllOtherCopies": "false"})
+                            ElementTree.SubElement(py_version, "Wheel",
+                                                   {"Name": found_wheel[0],
+                                                    "Path": found_wheel[1],
+                                                    "Version": package_version,
+                                                    
+ "UninstallAllOtherCopies": "false"})
         elif root_element.tag == "Python":
             py_version = root_element
             present_wheels = []
@@ -130,11 +130,11 @@ def _set_version_number_and_wheels_cr_tools_installer_config(package_version, wh
                             present_wheels.append(found_wheel[0])
             for found_wheel in wheels:
                 if found_wheel[0] not in present_wheels:
-                    new_element = ElementTree.SubElement(py_version, "Wheel",
-                                                         {"Name": found_wheel[0],
-                                                          "Path": found_wheel[1],
-                                                          "Version": package_version,
-                                                          "UninstallAllOtherCopies": "false"})
+                    ElementTree.SubElement(py_version, "Wheel",
+                                           {"Name": found_wheel[0],
+                                            "Path": found_wheel[1],
+                                            "Version": package_version,
+                                            "UninstallAllOtherCopies": 
+ "false"})
     tree.write(file_path)
     print("Installer config regenerated successfully")

@@ -199,16 +199,16 @@ def build_wheels(extension_pkgs):
     dir_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
     file_path = os.path.join(dir_path, "setup.py")
     if ostype == WIN:
-        check_call("py {} \"{}\" bdist_wheel".format(PYTHON_VERSION, file_path), shell=True, cwd=dir_path)
+        check_call("py -{} \"{}\" bdist_wheel".format(PYTHON_VERSION, 
+ file_path), shell=True, cwd=dir_path)
     else:
-        check_call('python3 "{}" bdist_wheel'.format(file_path), shell=True, cwd=dir_path)
+        check_call('python{} "{}" bdist_wheel'.format(PYTHON_VERSION, 
+ file_path), shell=True, cwd=dir_path)
     for pkg in extension_pkgs:
         ext_dir_path = os.path.abspath(pkg)
         ext_file_path = os.path.join(ext_dir_path, 'setup.py')
         if ostype == WIN:
-            check_call("py {} \"{}\" bdist_wheel".format(PYTHON_VERSION, ext_file_path), shell=True, cwd=ext_dir_path)
+            check_call("py -{} \"{}\" 
+ bdist_wheel".format(PYTHON_VERSION, ext_file_path), shell=True, 
+ cwd=ext_dir_path)
         else:
-            check_call('python3 "{}" bdist_wheel'.format(ext_file_path), shell=True, cwd=ext_dir_path)
+            check_call('python{} "{}" 
+ bdist_wheel'.format(PYTHON_VERSION, ext_file_path), shell=True, 
+ cwd=ext_dir_path)
     print("Wheels built successfully")

 def copy_wheels_and_set_xml(package_version, extension_pkgs):
--
2.20.1


      reply	other threads:[~2020-01-02 19:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-27  2:05 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix PYTHON_VERSION usage Nate DeSimone
2020-01-02 19:25 ` Desimone, Ashley E [this message]

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=4CF3A9EB60ABDA47BE7821A4DA3A0A3353CCB7BA@ORSMSX116.amr.corp.intel.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