fix windows building

This commit is contained in:
Wolf Vollprecht 2019-03-22 19:12:49 +01:00
parent d95dd6a5b1
commit 64a7d173c4
6 changed files with 52 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import sys, os
@ -97,7 +97,7 @@ def main():
channel_json = [(str(x.channel), x.cache_path_json) for x in index]
installed_pkg_recs, output = get_installed_packages(prefix, show_channel_urls=True)
installed_json_f = tempfile.NamedTemporaryFile('w')
installed_json_f = tempfile.NamedTemporaryFile('w', delete=False)
installed_json_f.write(json_dump(output))
installed_json_f.flush()
@ -163,5 +163,12 @@ def main():
conda_transaction = UnlinkLinkTransaction(pref_setup)
handle_txn(conda_transaction, prefix, args, True)
try:
installed_json_f.close()
os.unlink(installed_json_f.name)
except:
pass
if __name__ == '__main__':
sys.exit(main())

View File

@ -3,7 +3,16 @@
#include <array>
#include <string>
#include <stdexcept>
#include <string_view>
#ifndef _WIN32
#include <string_view>
#else
#include "thirdparty/string_view.hpp"
namespace std {
using namespace nonstd;
}
#endif
#include <cassert>
extern "C"
@ -31,6 +40,10 @@ std::string normalize_version(std::string_view version, int build_number)
return out;
}
std::string force_string(const std::string_view& sv) {
return std::string(sv.cbegin(), sv.cend());
}
std::string normalize_version(std::string_view version, int build_number, std::string_view build)
{
static const std::string zero = "0";
@ -41,7 +54,7 @@ std::string normalize_version(std::string_view version, int build_number, std::s
out += ".";
out += std::to_string(build_number);
out += "-";
out += build;
out += force_string(build);
return out;
}

View File

@ -5,7 +5,14 @@
#include <array>
#include <string>
#include <stdexcept>
#include <string_view>
#ifndef _WIN32
#include <string_view>
#else
#include "thirdparty/string_view.hpp"
namespace std {
using namespace nonstd;
}
#endif
#include <cassert>
extern "C"

View File

@ -37,6 +37,16 @@
#ifndef PYSTRING_DEFAULT_STRING_VIEW
// #include "string_view_lite.hpp"
#ifndef _WIN32
#include <string_view>
#else
#include "thirdparty/string_view.hpp"
namespace std {
using namespace nonstd;
}
#endif
namespace pystring
{
using string_view = std::string_view;

View File

@ -427,6 +427,15 @@ static inline void print_with_escapes(const char *src, std::ostream &os) {
#ifndef SIMDJSON_JSONIOUTIL_H
#define SIMDJSON_JSONIOUTIL_H
#ifndef _WIN32
#include <string_view>
#else
#include "../string_view.hpp"
namespace std {
using namespace nonstd;
}
#endif
#include <exception>
#include <fstream>
#include <iostream>

View File

@ -40,8 +40,7 @@ ext_modules = [
get_pybind_include(user=True)
],
extra_link_args=settings['extra_link_args'],
library_dirs=[os.path.join(libsolv_prefix, 'lib/'),
os.path.join(libsolv_prefix, 'bin/')],
library_dirs=[os.path.join(libsolv_prefix, 'lib/')],
libraries=['solv'],
language='c++'
),