From 401efbb58d9a972d51ae62f4272ee0ee4154e354 Mon Sep 17 00:00:00 2001 From: Tue Herlau <tuhe@dtu.dk> Date: Wed, 12 Jul 2023 20:42:15 +0200 Subject: [PATCH] updatse --- setup.py | 2 +- src/unitgrade_devel.egg-info/PKG-INFO | 2 +- src/unitgrade_private/run.py | 21 +++++++++++++++++++-- src/unitgrade_private/version.py | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 7e5ae34..df84b3a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # Use this guide: # https://packaging.python.org/tutorials/packaging-projects/ # py -m build && twine upload dist/* -# LINUX: python -m build && twine upload dist/* +# LINUX: python -m build && python -m twine upload dist/* # Local install: sudo pip install -e ./ diff --git a/src/unitgrade_devel.egg-info/PKG-INFO b/src/unitgrade_devel.egg-info/PKG-INFO index fcaff41..60a3ee1 100644 --- a/src/unitgrade_devel.egg-info/PKG-INFO +++ b/src/unitgrade_devel.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: unitgrade-devel -Version: 0.1.52 +Version: 0.1.53 Summary: A set of tools to develop unitgrade tests and reports and later evaluate them Home-page: https://lab.compute.dtu.dk/tuhe/unitgrade_private Author: Tue Herlau diff --git a/src/unitgrade_private/run.py b/src/unitgrade_private/run.py index 01a5463..6a143fe 100644 --- a/src/unitgrade_private/run.py +++ b/src/unitgrade_private/run.py @@ -3,10 +3,9 @@ import select import subprocess import sys - # logger = logging.getLogger() -def run(cmd: str | list, print_output=True, log_output=False, check=True, *args, **kwargs) -> subprocess.Popen: +def run(cmd : str | list, print_output=True, log_output=False, check=True, *args, **kwargs) -> subprocess.Popen: """Run a command, with superpowers * cmd: The command to run. If a string, it will be passed to a shell. @@ -30,6 +29,24 @@ def run(cmd: str | list, print_output=True, log_output=False, check=True, *args, The Popen object is always returned. """ shell = isinstance(cmd, str) + import os + if os.name == "nt": # th juli 2023: annoying winows problem. + print("Warning, due to problem on windows the console output will not be shown while the command is runnign (error due to select.select).") + import subprocess + p = subprocess.run(cmd, shell=True, encoding="utf-8", capture_output=True) + # out_ = p.stdout + # err_ = p.stderr + class std_: + def __init__(self, s): + self.s = s + def getvalue(self): + return self.s + p.stdout = std_(p.stdout) + p.stderr = std_(p.stderr) + return p + + + # logger.debug(f"Running command: {cmd}") process = subprocess.Popen( diff --git a/src/unitgrade_private/version.py b/src/unitgrade_private/version.py index c384a4f..d7ae2c8 100644 --- a/src/unitgrade_private/version.py +++ b/src/unitgrade_private/version.py @@ -1,2 +1,2 @@ -__version__ = "0.1.52" +__version__ = "0.1.53" -- GitLab