@@ -88,20 +88,29 @@ def run_in_barbican_venv(ctx, client, args):
8888 run .Raw ('&&' )
8989 ] + args )
9090
91+ def get_constraints_url (cconf ):
92+ version = cconf .get ('force-branch' , 'master' )
93+ if '/' in version :
94+ # split stable/<version> to <version>
95+ version = str (version ).split ('/' )[1 ]
96+ url = f"https://releases.openstack.org/constraints/upper/{ version } "
97+ return url
98+
9199@contextlib .contextmanager
92100def setup_venv (ctx , config ):
93101 """
94102 Setup the virtualenv for Barbican using pip.
95103 """
96104 assert isinstance (config , dict )
97105 log .info ('Setting up virtualenv for barbican...' )
98- for (client , _ ) in config .items ():
106+ for (client , cconf ) in config .items ():
99107 run_in_barbican_dir (ctx , client ,
100108 ['python3' , '-m' , 'venv' , '.barbicanenv' ])
101109 run_in_barbican_venv (ctx , client ,
102110 ['pip' , 'install' , '--upgrade' , 'pip' ])
111+ url = get_constraints_url (cconf )
103112 run_in_barbican_venv (ctx , client ,
104- ['pip' , 'install' , 'pytz' ,
113+ ['pip' , 'install' , f'-c { url } ' , 'pytz' ,
105114 '-e' , get_barbican_dir (ctx )])
106115 yield
107116
0 commit comments