|
36 | 36 | 'uninstall': False, |
37 | 37 | 'pyoptsparse_version': None, # Parsed pyOptSparse version, set by finish_setup() |
38 | 38 | 'make_name': 'make', |
39 | | - 'fall_back': False |
| 39 | + 'fall_back': False, |
| 40 | + 'pip_cmd': 'pip' |
40 | 41 | } |
41 | 42 |
|
42 | 43 | # Information about the host, status, and constants |
@@ -184,6 +185,9 @@ def process_command_line(): |
184 | 185 | parser.add_argument("-p", "--prefix", |
185 | 186 | help=f"Where to install if not a conda/venv environment. Default: {opts['prefix']}", |
186 | 187 | default=opts['prefix']) |
| 188 | + parser.add_argument("--pip-cmd", |
| 189 | + help=f"pip command to use. Set to to --pip-cmd=='uv pip' if using uv. Default: {opts['pip_cmd']}", |
| 190 | + default=opts['pip_cmd']) |
187 | 191 | parser.add_argument("-s", "--snopt-dir", |
188 | 192 | help="Include SNOPT from SNOPT-DIR. Default: no SNOPT", |
189 | 193 | default=opts['snopt_dir']) |
@@ -250,6 +254,7 @@ def process_command_line(): |
250 | 254 |
|
251 | 255 | opts['prefix'] = args.prefix |
252 | 256 | opts['build_pyoptsparse'] = not args.no_install |
| 257 | + opts['pip_cmd'] = args.pip_cmd |
253 | 258 | opts['snopt_dir'] = args.snopt_dir |
254 | 259 | opts['hsl_tar_file'] = args.hsl_tar_file |
255 | 260 | opts['verbose'] = args.verbose |
@@ -487,11 +492,11 @@ def pip_install(pip_install_args, pkg_desc='packages'): |
487 | 492 | Each token of the command line is a separate member of the list. The |
488 | 493 | is prepended with 'python -m pip install'; '-q' is added when not verbose. |
489 | 494 | """ |
490 | | - cmd_list = ['python', '-m', 'pip', 'install'] |
| 495 | + cmd_list = opts['pip_cmd'].split() + ['install'] |
491 | 496 | if opts['verbose'] is False: |
492 | 497 | cmd_list.append('-q') |
493 | 498 | cmd_list.extend(pip_install_args) |
494 | | - note(f'Installing {pkg_desc} with pip') |
| 499 | + note(f'Installing {pkg_desc} with {opts["pip_cmd"]}') |
495 | 500 | run_cmd(cmd_list) |
496 | 501 | note_ok() |
497 | 502 |
|
@@ -1158,7 +1163,7 @@ def check_sanity(): |
1158 | 1163 | check_make(errors) |
1159 | 1164 | required_cmds.extend(['git', os.environ['CC'], os.environ['CXX'], os.environ['FC']]) |
1160 | 1165 | if opts['build_pyoptsparse'] is True: |
1161 | | - required_cmds.extend(['pip', 'swig']) |
| 1166 | + required_cmds.extend(['swig']) |
1162 | 1167 |
|
1163 | 1168 | if opts['compile_required'] is False: |
1164 | 1169 | required_cmds.append(opts['conda_cmd']) |
@@ -1197,17 +1202,17 @@ def check_sanity(): |
1197 | 1202 |
|
1198 | 1203 | def select_intel_compilers(): |
1199 | 1204 | """ Set environment variables to use Intel compilers. """ |
1200 | | - os.environ['CC'] = 'icc' |
1201 | | - os.environ['CXX'] = 'icpc' |
1202 | | - os.environ['FC'] = 'ifort' |
| 1205 | + os.environ['CC'] = os.environ.get('CC', 'icc') |
| 1206 | + os.environ['CXX'] = os.environ.get('CXX', 'icpc') |
| 1207 | + os.environ['FC'] = os.environ.get('FC', 'ifort') |
1203 | 1208 | sys_info['gcc_major_ver'] = -1 |
1204 | 1209 | sys_info['gcc_is_apple_clang'] = False |
1205 | 1210 |
|
1206 | 1211 | def select_gnu_compilers(): |
1207 | 1212 | """ Set environment variables to use GNU compilers. """ |
1208 | | - os.environ['CC'] = 'gcc' |
1209 | | - os.environ['CXX'] = 'g++' |
1210 | | - os.environ['FC'] = 'gfortran' |
| 1213 | + os.environ['CC'] = os.environ.get('CC', 'gcc') |
| 1214 | + os.environ['CXX'] = os.environ.get('CXX', 'g++') |
| 1215 | + os.environ['FC'] = os.environ.get('FC', 'gfortran') |
1211 | 1216 | gcc_ver = subprocess.run(['gcc', '-dumpversion'], capture_output=True) |
1212 | 1217 | sys_info['gcc_major_ver'] = int(gcc_ver.stdout.decode('UTF-8').split('.')[0]) |
1213 | 1218 | gcc_version = subprocess.run(['gcc', '--version'], capture_output=True) |
|
0 commit comments