gpg: add an argument for the import directory
This is hidden because it is only meant for use by the tests.
This commit is contained in:
parent
a48b5a627c
commit
f564b2abf7
@ -23,6 +23,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack.util.gpg import Gpg
|
from spack.util.gpg import Gpg
|
||||||
|
import argparse
|
||||||
import spack
|
import spack
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -87,8 +88,9 @@ def setup_parser(subparser):
|
|||||||
list.set_defaults(func=gpg_list)
|
list.set_defaults(func=gpg_list)
|
||||||
|
|
||||||
init = subparsers.add_parser('init')
|
init = subparsers.add_parser('init')
|
||||||
|
init.add_argument('--from', metavar='DIR', type=str,
|
||||||
|
dest='import_dir', help=argparse.SUPPRESS)
|
||||||
init.set_defaults(func=gpg_init)
|
init.set_defaults(func=gpg_init)
|
||||||
init.set_defaults(import_dir=spack.gpg_keys_path)
|
|
||||||
|
|
||||||
export = subparsers.add_parser('export')
|
export = subparsers.add_parser('export')
|
||||||
export.add_argument('location', type=str,
|
export.add_argument('location', type=str,
|
||||||
@ -144,7 +146,11 @@ def gpg_trust(args):
|
|||||||
|
|
||||||
|
|
||||||
def gpg_init(args):
|
def gpg_init(args):
|
||||||
for root, _, filenames in os.walk(args.import_dir):
|
import_dir = args.import_dir
|
||||||
|
if import_dir is None:
|
||||||
|
import_dir = spack.gpg_keys_path
|
||||||
|
|
||||||
|
for root, _, filenames in os.walk(import_dir):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if not filename.endswith('.key'):
|
if not filename.endswith('.key'):
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user