Fix windows, and use verbosity flag
This commit is contained in:
Wolf Vollprecht 2019-12-11 15:20:04 +01:00 committed by GitHub
parent 94990e0e9a
commit b94c510105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 13 deletions

33
.appveyor.yml Normal file
View File

@ -0,0 +1,33 @@
build: false
os: Visual Studio 2015
platform:
- x64
environment:
matrix:
- MINICONDA: C:\mamba
init:
- "ECHO %MINICONDA%"
- C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat %PLATFORM%
- ps: if($env:Platform -eq "x64"){Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe' C:\Miniconda.exe; echo "Done"}
- ps: if($env:Platform -eq "x86"){Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86.exe' C:\Miniconda.exe; echo "Done"}
- cmd: C:\Miniconda.exe /S /D=C:\mamba
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%MINICONDA%\\Library\\bin;%PATH%"
install:
# Install conda
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda install libsolv pip pybind11 vs2015_win-64 -c conda-forge
- activate base
# Build
- pip install -e . --verbose --no-deps
build_script:
# - mamba create -n testenv xtensor -c conda-forge
# - mamba create -n xenv xtensor xtensor-r xeus xeus-cling -c conda-forge --dry-run
# - mamba env create -n testenv --file test.yml

View File

@ -108,12 +108,13 @@ solve(std::vector<std::tuple<std::string, std::string, int, int>> repos,
std::vector<std::pair<int, int>> solver_options,
int solvable_flags,
bool strict_priority,
bool quiet)
bool quiet,
int debug_level)
{
Pool* pool = pool_create();
pool_setdisttype(pool, DISTTYPE_CONDA);
// pool_setdebuglevel(pool, 2);
pool_setdebuglevel(pool, debug_level);
global_pool = pool;
@ -166,6 +167,8 @@ solve(std::vector<std::tuple<std::string, std::string, int, int>> repos,
{
repo_add_conda(repo, fp, 0);
repo_internalize(repo);
// disabling solv caching for now on Windows
#if !defined(WIN32)
auto solv_name = repo_json_file.substr(0, repo_json_file.size() - ending.size());
solv_name += ending;
// PRINT("creating solv: " << solv_name);
@ -175,6 +178,7 @@ solve(std::vector<std::tuple<std::string, std::string, int, int>> repos,
tool_write(repo, sfile);
fclose(sfile);
}
#endif
}
else
{

View File

@ -33,6 +33,7 @@ solve(std::vector<std::tuple<std::string, std::string, int, int>> repos,
std::vector<std::pair<int, int>> solver_options,
int solver_flags,
bool strict_priority,
bool quiet);
bool quiet,
int debug_level);
#endif

View File

@ -4,6 +4,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import bz2
import sys, os
from collections import defaultdict
from contextlib import closing
from errno import EACCES, ENODEV, EPERM
@ -97,6 +98,17 @@ class FastSubdirData(object):
def cache_path_solv(self):
return self.cache_path_base + '.solv'
def get_loaded_file_path(self):
if sys.platform == 'win32':
return self.cache_path_json
if os.path.exists(self.cache_path_solv) and \
self.cache_content_changed == False and \
os.path.getmtime(self.cache_path_solv) > os.path.getmtime(self.cache_path_json):
return self.cache_path_solv
return self.cache_path_json
def load(self):
self._load()
self._loaded = True

View File

@ -233,7 +233,8 @@ def remove(args, parser):
solver_options,
api.SOLVER_ERASE,
False,
context.quiet)
context.quiet,
context.verbosity)
conda_transaction = to_txn(specs, prefix, to_link, to_unlink)
handle_txn(conda_transaction, prefix, args, False, True)
@ -335,13 +336,8 @@ def install(args, parser, command='install'):
priority = 0
subpriority = 0 if x.channel.platform == 'noarch' else 1
cache_file = x.get_loaded_file_path()
if os.path.exists(x.cache_path_solv) and \
x.cache_content_changed == False and \
os.path.getmtime(x.cache_path_solv) > os.path.getmtime(x.cache_path_json):
cache_file = x.cache_path_solv
else:
cache_file = x.cache_path_json
channel_json.append((str(x.channel), cache_file, priority, subpriority))
installed_json_f = get_installed_jsonfile(prefix)
@ -411,7 +407,8 @@ def install(args, parser, command='install'):
solver_options,
solver_task,
strict_priority,
context.quiet)
context.quiet,
context.verbosity)
conda_transaction = to_txn(specs, prefix, to_link, to_unlink, index)
handle_txn(conda_transaction, prefix, args, newenv)

View File

@ -69,7 +69,8 @@ def mamba_install(prefix, specs, args, env, *_, **kwargs):
solver_options,
api.SOLVER_INSTALL,
False,
context.quiet)
context.quiet,
context.verbosity)
to_link_records, to_unlink_records = [], []

View File

@ -27,7 +27,7 @@ class get_pybind_include(object):
return pybind11.get_include(self.user)
if sys.platform.startswith('win'):
libsolv_prefix = os.path.join(sys.prefix, 'Library/')
libsolv_prefix = os.path.join(sys.prefix, 'Library\\')
else:
libsolv_prefix = sys.prefix
@ -37,6 +37,20 @@ extra_link_args = []
if sys.platform == 'darwin':
extra_link_args = ['-Wl,-rpath', '-Wl,%s' % os.path.abspath(libsolv_prefix)]
library_dir = []
if sys.platform == 'win32':
try:
conda_prefix = os.getenv('CONDA_PREFIX')
if not conda_prefix:
conda_prefix = os.getenv('MINICONDA')
if not conda_prefix:
raise RuntimeError("No conda prefix found")
library_dir = [os.path.join(conda_prefix, 'Library\\lib\\')]
print("Looking for libsolv library in ", library_dir)
except:
print("could not find conda prefix")
ext_modules = [
Extension(
'mamba.mamba_api',
@ -46,6 +60,7 @@ ext_modules = [
get_pybind_include(user=True),
os.path.join(libsolv_prefix, 'include')
],
library_dirs=library_dir,
libraries=['solv', 'solvext'],
language='c++'
),