def test(m): tmp_dir = join(config.croot, 'test-tmp_dir') rm_rf(tmp_dir) os.makedirs(tmp_dir) if not create_files(tmp_dir, m): print("Nothing to test for:", m.dist()) return print("TEST START:", m.dist()) rm_rf(prefix) rm_rf(config.test_prefix) specs = ['%s %s %s' % (m.name(), m.version(), m.build_id()), # as the tests are run by python, we need to specify it 'python %s*' % environ.py_ver] # add packages listed in test/requires for spec in m.get_value('test/requires'): specs.append(spec) create_env(config.test_prefix, specs) env = dict(os.environ) # prepend bin/Scripts directory env['PATH'] = (join(config.test_prefix, bin_dirname) + os.pathsep + env['PATH']) for varname in 'CONDA_PY', 'CONDA_NPY': env[varname] = str(getattr(config, varname)) env['PREFIX'] = config.test_prefix _check_call([config.test_python, join(tmp_dir, 'run_test.py')], env=env, cwd=tmp_dir) print("TEST END:", m.dist())
def build(m): env = dict(os.environ) env.update(environ.get_dict(m)) for name in 'BIN', 'INC', 'LIB': path = env['LIBRARY_' + name] if not isdir(path): os.makedirs(path) src_dir = source.get_dir() bld_bat = join(m.path, 'bld.bat') with open(bld_bat) as fi: data = fi.read() with open(join(src_dir, 'bld.bat'), 'w') as fo: fo.write(msvc_env_cmd()) # more debuggable with echo on fo.write('@echo on\n') for kv in iteritems(env): fo.write('set %s=%s\n' % kv) fo.write("REM ===== end generated header =====\n") fo.write(data) cmd = [os.environ['COMSPEC'], '/c', 'bld.bat'] _check_call(cmd, cwd=src_dir) kill_processes() fix_staged_scripts()
def build(m, get_src=True, pypi=False): rm_rf(prefix) create_env(prefix, [ms.spec for ms in m.ms_depends('build')], pypi) print("BUILD START:", m.dist()) if get_src: source.provide(m.path, m.get_section('source')) assert isdir(source.WORK_DIR) if os.listdir(source.get_dir()): print("source tree in:", source.get_dir()) else: print("no source") rm_rf(info_dir) files1 = prefix_files() if sys.platform == 'win32': import conda.builder.windows as windows windows.build(m) else: build_sh = join(m.path, 'build.sh') if exists(build_sh): env = environ.get_dict(m) cmd = ['/bin/bash', '-x', '-e', build_sh] _check_call(cmd, env=env, cwd=source.get_dir()) else: print("no build.sh file") create_entry_points(m.get_value('build/entry_points')) post_process(preserve_egg_dir=bool( m.get_value('build/preserve_egg_dir'))) assert not exists(info_dir) files2 = prefix_files() post_build(sorted(files2 - files1)) create_info_files(m, sorted(files2 - files1)) files3 = prefix_files() fix_permissions(files3 - files1) path = bldpkg_path(m) t = tarfile.open(path, 'w:bz2') for f in sorted(files3 - files1): t.add(join(prefix, f), f) t.close() print("BUILD END:", m.dist()) # we're done building, perform some checks tarcheck.check_all(path) update_index(bldpkgs_dir)
def build(m, get_src=True): rm_rf(prefix) create_env(prefix, [ms.spec for ms in m.ms_depends('build')]) print("BUILD START:", m.dist()) if get_src: source.provide(m.path, m.get_section('source')) assert isdir(source.WORK_DIR) if os.listdir(source.get_dir()): print("source tree in:", source.get_dir()) else: print("no source") rm_rf(info_dir) files1 = prefix_files() if sys.platform == 'win32': import conda.builder.windows as windows windows.build(m.path) else: env = environ.get_dict() env['RECIPE_DIR'] = m.path cmd = ['/bin/bash', '-x', '-e', join(m.path, 'build.sh')] _check_call(cmd, env=env, cwd=source.get_dir()) create_entry_points(m.get_value('build/entry_points')) post_process() assert not exists(info_dir) files2 = prefix_files() sorted_files = sorted(files2 - files1) post_build(sorted_files) create_info_files(m, sorted_files) files3 = prefix_files() fix_permissions() path = bldpkg_path(m) t = tarfile.open(path, 'w:bz2') for f in sorted(files3 - files1): t.add(join(prefix, f), f) t.close() print("BUILD END:", m.dist()) # we're done building, perform some checks tarcheck.check_all(path) update_index(bldpkgs_dir) # remove from packages, because we're going to test it rm_pkgs_cache(m.dist()) test(m)
def compile_missing_pyc(): sp_dir = environ.sp_dir need_compile = False for root, dirs, files in os.walk(sp_dir): for fn in files: if fn.endswith(".py") and fn + "c" not in files: need_compile = True if need_compile: print("compiling .pyc files...") utils._check_call( [build_python, "-Wi", join(environ.stdlib_dir, "compileall.py"), "-q", "-x", "port_v3", sp_dir] )
def compile_missing_pyc(): sp_dir = environ.sp_dir need_compile = False for root, dirs, files in os.walk(sp_dir): for fn in files: if fn.endswith('.py') and fn + 'c' not in files: need_compile = True if need_compile: print('compiling .pyc files...') utils._check_call([build_python, '-Wi', join(environ.stdlib_dir, 'compileall.py'), '-q', '-x', 'port_v3', sp_dir])
def build(m, get_src=True, pypi=False): rm_rf(prefix) create_env(prefix, [ms.spec for ms in m.ms_depends('build')], pypi) print("BUILD START:", m.dist()) if get_src: source.provide(m.path, m.get_section('source')) assert isdir(source.WORK_DIR) if os.listdir(source.get_dir()): print("source tree in:", source.get_dir()) else: print("no source") rm_rf(info_dir) files1 = prefix_files() if sys.platform == 'win32': import conda.builder.windows as windows windows.build(m) else: build_sh = join(m.path, 'build.sh') if exists(build_sh): env = environ.get_dict(m) cmd = ['/bin/bash', '-x', '-e', build_sh] _check_call(cmd, env=env, cwd=source.get_dir()) else: print("no build.sh file") create_entry_points(m.get_value('build/entry_points')) post_process(preserve_egg_dir=bool(m.get_value('build/preserve_egg_dir'))) assert not exists(info_dir) files2 = prefix_files() post_build(sorted(files2 - files1)) create_info_files(m, sorted(files2 - files1)) files3 = prefix_files() fix_permissions(files3 - files1) path = bldpkg_path(m) t = tarfile.open(path, 'w:bz2') for f in sorted(files3 - files1): t.add(join(prefix, f), f) t.close() print("BUILD END:", m.dist()) # we're done building, perform some checks tarcheck.check_all(path) update_index(bldpkgs_dir)