From a7885e152f108e8f69b5edb92be34ef5a171b9d7 Mon Sep 17 00:00:00 2001 From: kaocher Date: Sat, 27 Mar 2021 00:43:10 +0600 Subject: [PATCH 1/3] Create python-publish.yml --- .github/workflows/python-publish.yml | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 00000000000000..1a03a7b6c4911d --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,31 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From 0669995b1a053a84598b215b37bb11159307295a Mon Sep 17 00:00:00 2001 From: kaocher Date: Tue, 30 Mar 2021 04:00:19 +0600 Subject: [PATCH 2/3] Update morning Morning path --- PCbuild/prepare_ssl.py | 64 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py index 0f3c63ee24ffba..242b0efdc31fea 100755 --- a/PCbuild/prepare_ssl.py +++ b/PCbuild/prepare_ssl.py @@ -25,6 +25,70 @@ import sys import subprocess from shutil import copy +import os +import yaml +from typing import NoReturn + + +def create_directory(directory: str) -> NoReturn: + """ + Create a directory if it doesn't exist. + + Parameters + ---------- + directory : string + A ``string`` of the full directory path to create if it doesn't exist. + """ + if not os.path.exists(directory): + os.makedirs(directory) + + +def update_log(logfile: str, contents: str) -> NoReturn: + """ + Append a log with new output from a test. + + Parameters + ---------- + logfile : string + A ``string`` of the logfile to write data to. + contents : string + A ``string`` of the contents to append the log file with. + """ + with open(logfile, 'a') as log: + log.write(contents) + + +def write_file(filename: str, contents: str) -> NoReturn: + """ + Write data to a file. + + Parameters + ---------- + filename : string + A ``string`` of the file to write data to. + contents : string + A ``string`` of the contents to write to the file. + """ + with open(filename, 'w') as fp: + fp.write(contents) + + +def read_yaml(filename: str) -> dict: + """ + Read a YAML file and return the contents. + + Parameters + ---------- + filename : string + A ``string`` of the full file path to read. + + Returns + ------- + dict + Returns a ``dict`` representing the entire contents of the file. + """ + with open(filename, 'r') as handler: + return yaml.safe_load(handler) # Find all "foo.exe" files on the PATH. def find_all_on_path(filename, extras=None): From 9b646f7721220d1042b9c995e536f77483f9ef70 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Mon, 29 Mar 2021 22:02:22 +0000 Subject: [PATCH 3/3] 'Refactored by Sourcery' --- PCbuild/prepare_ssl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py index 242b0efdc31fea..af4e605338ec19 100755 --- a/PCbuild/prepare_ssl.py +++ b/PCbuild/prepare_ssl.py @@ -135,12 +135,12 @@ def copy_includes(makefile, suffix): os.makedirs(dir) except OSError: pass - copy_if_different = r'$(PERL) $(SRC_D)\util\copy-if-different.pl' with open(makefile) as fin: + copy_if_different = r'$(PERL) $(SRC_D)\util\copy-if-different.pl' for line in fin: if copy_if_different in line: perl, script, src, dest = line.split() - if not '$(INCO_D)' in dest: + if '$(INCO_D)' not in dest: continue # We're in the root of the source tree src = src.replace('$(SRC_D)', '.').strip('"')