Skip to content

Commit

Permalink
Fixed GPGHOME setup for native Windows environment
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Oct 28, 2023
1 parent 9f2d6e9 commit b0a758d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/windows-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ jobs:
echo "VCPKG_DIR_U=$dir_u" >> $GITHUB_ENV
vcpkg install --triplet ${{ matrix.arch.triplet }} bzip2 zlib json-c getopt dirent ${{ matrix.backend }}
- name: Install gnupg
# There is gnupg on the runner but it is MSys version
run: choco install gnupg -y

- name: Set OPENSSL_ROOT_DIR
# Ensure consistent access to openssl installation for test_backend_version test
# There is another one instance of ssl at /mingw and /mingw/bin is always at the first position at PATH
Expand Down
9 changes: 5 additions & 4 deletions src/tests/cli_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def is_windows():

def path_for_gpg(path):
# GPG built for mingw/msys doesn't work with Windows paths
if re.match(r'^[a-z]:[\\\/].*', path.lower()):
# Native Windows program cannot work with MSys paths either
if re.match(r'^[a-z]:[\\\/].*', path.lower()) and sys.platform.startswith('msys'):
path = '/' + path[0] + '/' + path[3:].replace('\\', '/')
return path

Expand Down Expand Up @@ -100,7 +101,7 @@ def rnp_file_path(relpath, check = True):

def run_proc_windows(proc, params, stdin=None):
exe = os.path.basename(proc)
# test special quote cases
# test special quote cases
params = list(map(lambda st: st.replace('"', '\\"'), params))
# We need to escape empty parameters/ones with spaces with quotes
params = tuple(map(lambda st: st if (st and not any(x in st for x in [' ','\r','\t'])) else '"%s"' % st, [exe] + params))
Expand Down Expand Up @@ -176,9 +177,9 @@ def run_proc_windows(proc, params, stdin=None):
err = file_text(stderr_path).replace('\r\n', '\n')
os.unlink(stdout_path)
os.unlink(stderr_path)
if stdin:
if stdin:
os.unlink(stdin_path)
if passfo:
if passfo:
os.unlink(pass_path)
logging.debug(err.strip())
logging.debug(out.strip())
Expand Down
2 changes: 1 addition & 1 deletion src/tests/cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def setup(loglvl):
os.environ["RNP_LOG_CONSOLE"] = "1"

GPGDIR = os.path.join(WORKDIR, '.gpg')
GPGHOME = path_for_gpg(GPGDIR) if is_windows() else GPGDIR
GPGHOME = path_for_gpg(GPGDIR)
GPG = os.getenv('RNP_TESTS_GPG_PATH') or find_utility('gpg')
GPGCONF = os.getenv('RNP_TESTS_GPGCONF_PATH') or find_utility('gpgconf')
gpg_check_features()
Expand Down

0 comments on commit b0a758d

Please sign in to comment.