def main(): args = parse_args() source_path = os.getcwd() config = get_config(args.config_file) is_test = not config.getboolean('deploy', 'release') conda_base = get_conda_base(args.conda_base, is_test, config) base_activation_script = os.path.abspath( '{}/etc/profile.d/conda.sh'.format(conda_base)) activate_base = 'source {}; conda activate'.format(base_activation_script) activate_install_env = \ 'source {}; ' \ 'conda activate temp_compass_install'.format(base_activation_script) # install miniconda if needed install_miniconda(conda_base, activate_base) setup_install_env(activate_base) bootstrap(activate_install_env, source_path) remove_install_env(activate_base)
==== Example showing how to override the `paintEvent` and `eventFilter` for a `QDial`, creating a visually consistent, stylish `QDial` that supports highlighting the handle on the active or hovered dial. ''' import math import shared import sys parser = shared.create_parser() parser.add_argument('--no-align', help='''allow larger widgets without forcing alignment.''', action='store_true') args, unknown = shared.parse_args(parser) QtCore, QtGui, QtWidgets = shared.import_qt(args) compat = shared.get_compat_definitions(args) colors = shared.get_colors(args, compat) def radius(dial): '''Get the radius of the dial.''' return min(dial.rect.width(), dial.rect.height()) // 2 def groove_rect(dial): '''Calculate the bounding rectangle for the dial groove.''' x0 = dial.rect.width() / 2 y0 = dial.rect.height() / 2
def main(): args = parse_args() source_path = os.getcwd() template_path = '{}/conda/compass_env'.format(source_path) version = get_version() machine = None machine_info = None if not args.env_only: if args.machine is None: machine = discover_machine() else: machine = args.machine if machine is not None: machine_info = MachineInfo(machine=machine) config = get_config(args.config_file, machine) is_test = not config.getboolean('deploy', 'release') conda_base = get_conda_base(args.conda_base, is_test, config) base_activation_script = os.path.abspath( '{}/etc/profile.d/conda.sh'.format(conda_base)) activate_base = 'source {}; conda activate'.format(base_activation_script) python, recreate, compiler, mpi, conda_mpi, activ_suffix, env_suffix, \ activ_path = get_env_setup(args, config, machine, is_test, source_path, conda_base) if machine is None and not args.env_only and args.mpi is None: raise ValueError('Your machine wasn\'t recognized by compass but you ' 'didn\'t specify the MPI version. Please provide ' 'either the --mpi or --env_only flag.') if machine is None: if args.env_only: compiler = None elif platform.system() == 'Linux': compiler = 'gnu' elif platform.system() == 'Darwin': compiler = 'clang' else: compiler = 'gnu' if machine_info is not None: mpicc, mpicxx, mpifc, mod_commands, env_vars = \ machine_info.get_modules_and_mpi_compilers(compiler, mpi) else: # using conda-forge compilers mpicc = 'mpicc' mpicxx = 'mpicxx' mpifc = 'mpifort' mod_commands = list() env_vars = dict() env_path, env_name, activate_env = build_env( is_test, recreate, machine, compiler, mpi, conda_mpi, version, python, source_path, template_path, conda_base, activ_suffix, args.env_name, env_suffix, activate_base, args.use_local) if compiler is not None: sys_info, system_libs = build_system_libraries( config, machine, compiler, mpi, version, template_path, env_path, env_name, activate_base, activate_env, mpicc, mpicxx, mpifc, mod_commands, env_vars) else: sys_info = dict(modules=[], env_vars=[], mpas_netcdf_paths='') system_libs = None if is_test: if args.env_name is not None: prefix = 'load_{}'.format(args.env_name) else: prefix = 'load_dev_compass_{}'.format(version) else: prefix = 'load_compass_{}'.format(version) script_filename = write_load_compass(template_path, activ_path, conda_base, is_test, version, activ_suffix, prefix, env_name, machine, sys_info, args.env_only) if args.check: check_env(script_filename, env_name) commands = '{}; conda clean -y -p -t'.format(activate_base) check_call(commands) if machine is not None: update_permissions(config, is_test, activ_path, conda_base, system_libs)