public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix PYTHON_VERSION usage
@ 2019-12-27  2:05 Nate DeSimone
  2020-01-02 19:25 ` Desimone, Ashley E
  0 siblings, 1 reply; 2+ messages in thread
From: Nate DeSimone @ 2019-12-27  2:05 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Ashley DeSimone, Puja Pandya, Erik Bjorge,
	Bret Barkelew

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix PYTHON_VERSION usage
  2019-12-27  2:05 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix PYTHON_VERSION usage Nate DeSimone
@ 2020-01-02 19:25 ` Desimone, Ashley E
  0 siblings, 0 replies; 2+ messages in thread
From: Desimone, Ashley E @ 2020-01-02 19:25 UTC (permalink / raw)
  To: Desimone, Nathaniel L, devel@edk2.groups.io
  Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-02 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox