Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow providing absolute path to the certificate file when executing scons #10943

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions appx/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import subprocess
import versionInfo
import os

Import([
'env',
Expand All @@ -26,11 +27,15 @@ def getCertPublisher(env):
If no signing certificate is provided, then the given publisher is used as is.
If a signing certificate is given, then the publisher is extracted from the certificate.
"""
certFile=env.get('certFile')
if not certFile:
certFilePath = env.get('certFile')
if not certFilePath:
return env['publisher']
certPassword=env.get('certPassword','')
cmd=['certutil','-dump','-p',certPassword,File('#'+certFile).abspath.replace('/','\\')]
if not os.path.isabs(certFilePath):
# If path is not absolute it is assumed that it is being given relative to the top dir of the repo
repoTopDir = Dir('#').abspath
certFilePath = os.path.abspath(os.path.normpath(os.path.join(repoTopDir, certFilePath)))
cmd=['certutil', '-dump', '-p', certPassword, certFilePath]
lines=subprocess.run(cmd,check=True,capture_output=True,text=True).stdout.splitlines()
linePrefix='Subject: '
for line in lines:
Expand Down