Skip to content

Commit a368e8a

Browse files
author
gerrymanoim
authored
Merge pull request #179 from quantopian/ubuntu-lts
BLD: Start testing on ubuntu 20.04 LTS
2 parents 2ceb709 + 70d76c6 commit a368e8a

File tree

9 files changed

+34
-29
lines changed

9 files changed

+34
-29
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
os: [ubuntu-18.04, macos-10.15]
18+
os: [ubuntu-20.04, ubuntu-18.04, macos-10.15]
1919
python-version: [3.5, 3.6, 3.8]
2020
compiler: [gcc, clang]
2121
exclude:
@@ -32,11 +32,15 @@ jobs:
3232
- uses: actions/checkout@v2
3333
with:
3434
submodules: 'recursive'
35+
- name: Set release name env variable (ubuntu)
36+
if: startsWith(matrix.os, 'ubuntu')
37+
run: |
38+
echo ::set-env name=UBUNTU_RELEASE::$(lsb_release -sc)
3539
- name: Install newer clang (ubuntu)
3640
if: startsWith(matrix.os, 'ubuntu') && matrix.compiler == 'clang'
3741
run: |
3842
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
39-
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' -y
43+
sudo add-apt-repository "deb http://apt.llvm.org/$UBUNTU_RELEASE/ llvm-toolchain-$UBUNTU_RELEASE-10 main" -y
4044
sudo apt-get update -q
4145
sudo apt-get install -y clang-10 lld-10 libc++-10-dev libc++abi-10-dev clang-tools-10
4246
echo ::set-env name=AR::llvm-ar-10
@@ -78,14 +82,15 @@ jobs:
7882
- name: Set gcc envvars
7983
if: matrix.compiler == 'gcc'
8084
run: |
81-
echo ::set-env name=CC::gcc-8
82-
echo ::set-env name=CXX::g++-8
85+
echo ::set-env name=CC::gcc-9
86+
echo ::set-env name=CXX::g++-9
8387
- name: Run the tests
8488
run: |
8589
make -j2 test
86-
- name: Check that we can still install
90+
- name: Build and install from an sdist
8791
run: |
88-
pip install .
92+
python setup.py sdist
93+
pip install dist/libpy-*.tar.gz
8994
- name: Check that docs can be built
9095
run: |
9196
pip install sphinx sphinx_rtd_theme breathe ipython

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include etc/detect-compiler.cc
44
include etc/build-and-run
55
include etc/ext_suffix.py
66
include etc/asan-path
7+
include etc/ld_flags.py
78
include etc/python_version.py
89
include version
910
recursive-include src/ *.cc

Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ CXXFLAGS = $(BASE_CXXFLAGS) $($(COMPILER)_FLAGS)
6262

6363
# https://github.com/quantopian/libpy/pull/86/files#r309288697
6464
INCLUDE_DIRS := include/ \
65-
$(shell $(PYTHON) -c "from distutils import sysconfig; \
66-
print(sysconfig.get_config_var('INCLUDEPY'))") \
67-
$(shell $(PYTHON) -c "from distutils import sysconfig; \
68-
print(sysconfig.get_config_var('INCLUDEDIR'))") \
65+
$(shell $(PYTHON) -c "import sysconfig; \
66+
print(sysconfig.get_config_var('INCLDIRSTOMAKE'))") \
6967
$(shell $(PYTHON) -c 'import numpy as np;print(np.get_include())') \
7068
$(EXTRA_INCLUDE_DIRS)
7169
INCLUDE := $(foreach d,$(INCLUDE_DIRS), -I$d)
@@ -92,7 +90,7 @@ else
9290
CXXFLAGS += -fstack-protector-strong
9391
SONAME_FLAG := soname
9492
SONAME_PATH := $(SONAME)
95-
LDFLAGS += $(shell $(PYTHON)-config --ldflags)
93+
LDFLAGS += $(shell $(PYTHON) etc/ld_flags.py)
9694
LDFLAGS += -lstdc++fs
9795
LD_PRELOAD_VAR := LD_PRELOAD
9896
endif

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ libpy supports:
2525

2626
libpy requires:
2727

28-
- gcc>=8 or clang>=10
28+
- gcc>=9 or clang>=10
2929
- numpy>=1.11.3
3030

3131
Optional Requirements

docs/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ lipy supports:
1111

1212
lipy requires:
1313

14-
- gcc>=8 or clang>=10
14+
- gcc>=9 or clang>=10
1515
- numpy>=1.11.3
1616

1717
Optional Requirements

etc/Makefile.buildkite

Lines changed: 0 additions & 7 deletions
This file was deleted.

etc/ld_flags.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# via https://github.com/python/cpython/blob/deb016224cc506503fb05e821a60158c83918ed4/Misc/python-config.in#L50 # noqa
2+
3+
import sysconfig
4+
5+
libs = []
6+
libpl = sysconfig.get_config_vars('LIBPL')
7+
if libpl:
8+
libs.append("-L"+libpl[0])
9+
10+
libpython = sysconfig.get_config_var('LIBPYTHON')
11+
if libpython:
12+
libs.append(libpython)
13+
libs.extend(sysconfig.get_config_vars("LIBS", "SYSLIBS"))
14+
print(' '.join(libs))

include/libpy/to_object.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ struct to_object<std::filesystem::path> {
142142
static py::owned_ref<> f(const std::filesystem::path& path) {
143143
py::owned_ref path_str{
144144
PyUnicode_FromStringAndSize(path.c_str(), path.native().length())};
145-
#if PY_VERSION_HEX >= 0x03040000
145+
146146
py::owned_ref pathlib(PyImport_ImportModule("pathlib"));
147147
if (!pathlib) {
148148
throw py::exception();
@@ -158,9 +158,6 @@ struct to_object<std::filesystem::path> {
158158
throw py::exception();
159159
}
160160
return path_obj;
161-
#else
162-
return path_str;
163-
#endif
164161
}
165162
};
166163

tests/test_to_object.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,16 @@ TEST_F(to_object, filesystem_path) {
138138
std::filesystem::path test_path = "/tmp/";
139139
py::owned_ref ob = py::to_object(test_path);
140140
ASSERT_TRUE(ob);
141-
#if PY_VERSION_HEX >= 0x03040000
141+
142142
py::owned_ref ns = RUN_PYTHON(R"(
143143
from pathlib import Path
144144
py_path = Path("/tmp/")
145145
)");
146146
ASSERT_TRUE(ns);
147147

148-
py::owned_ref py_path_ob{PyDict_GetItemString(ns.get(), "py_path")};
148+
py::borrowed_ref py_path_ob = PyDict_GetItemString(ns.get(), "py_path");
149149
ASSERT_TRUE(py_path_ob);
150-
#else
151-
py::owned_ref py_path_ob = py::to_object("/tmp/");
152150

153-
#endif
154151
int eq = PyObject_RichCompareBool(ob.get(), py_path_ob.get(), Py_EQ);
155152
EXPECT_EQ(eq, 1);
156153
}

0 commit comments

Comments
 (0)