Skip to content

Commit b532b0d

Browse files
Joe Jevnikllllllllll
authored andcommitted
BLD: fix the sdist and manage the version in one place
1 parent 862b17b commit b532b0d

File tree

5 files changed

+32
-13
lines changed

5 files changed

+32
-13
lines changed

MANIFEST.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
include Makefile
2+
include etc/detect-compiler.cc
3+
include etc/build-and-run
4+
include etc/ext_suffix.py
5+
include etc/asan-path
6+
include etc/python-version.py
7+
include version
8+
19
include LICENSE
210
include libpy/libpy.so
311
include libpy/_build-and-run

Makefile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ PYTHON ?= python
77
PYTEST ?= pytest
88
EXTRA_INCLUDE_DIRS ?=
99

10-
MAJOR_VERSION := 1
11-
MINOR_VERSION := 0
12-
MICRO_VERSION := 0
10+
CLANG_TIDY ?= clang-tidy
11+
CLANG_FORMAT ?= clang-format
12+
GTEST_BREAK ?= 1
13+
14+
# not using $(file <version) because it was added in GNU Make 4.2 which is
15+
# newer that what is on macos and our github actions workers
16+
VERSION_PARTS := $(subst ., ,$(shell cat version))
17+
MAJOR_VERSION := $(word 1,$(VERSION_PARTS))
18+
MINOR_VERSION := $(word 2,$(VERSION_PARTS))
19+
MICRO_VERSION := $(word 3,$(VERSION_PARTS))
1320

1421
PY_VERSION := $(shell $(PYTHON) etc/python_version.py)
1522
PY_MAJOR_VERSION := $(word 1,$(PY_VERSION))
1623
PY_MINOR_VERSION := $(word 2,$(PY_VERSION))
1724

18-
CLANG_TIDY ?= clang-tidy
19-
CLANG_FORMAT ?= clang-format
20-
GTEST_BREAK ?= 1
21-
2225
COMPILER := $(shell CXX=$(CXX) ./etc/build-and-run etc/detect-compiler.cc)
2326
ifeq ($(COMPILER),UNKNOWN)
2427
$(warning Could not detect which compiler is being used, assuming gcc.)
@@ -49,7 +52,10 @@ BASE_CXXFLAGS = -std=gnu++17 -g -O$(OPTLEVEL) \
4952
-fvisibility=hidden \
5053
$(WARNINGS) \
5154
-DPY_MAJOR_VERSION=$(PY_MAJOR_VERSION) \
52-
-DPY_MINOR_VERSION=$(PY_MINOR_VERSION)
55+
-DPY_MINOR_VERSION=$(PY_MINOR_VERSION) \
56+
-DLIBPY_MAJOR_VERSION=$(MAJOR_VERSION) \
57+
-DLIBPY_MINOR_VERSION=$(MINOR_VERSION) \
58+
-DLIBPY_MICRO_VERSION=$(MICRO_VERSION)
5359
GCC_FLAGS = -fmax-errors=$(MAX_ERRORS)
5460
CLANG_FLAGS = -ferror-limit=$(MAX_ERRORS)
5561
CXXFLAGS = $(BASE_CXXFLAGS) $($(COMPILER)_FLAGS)
@@ -222,7 +228,7 @@ tests/%.o: tests/%.cc .make/all-flags
222228

223229
$(TEST_MODULE): gtest.a $(TEST_OBJECTS) libpy/libpy.so
224230
$(CXX) -shared -o $@ $(TEST_OBJECTS) gtest.a $(TEST_INCLUDE) \
225-
-Wl,-rpath,`pwd` -lpthread -L. $(SONAME) $(LDFLAGS)
231+
-Wl,-rpath,`pwd` -lpthread -L. $(SONAME) $(LDFLAGS)
226232

227233
gtest.o: $(GTEST_SRCS) .make/all-flags
228234
$(CXX) $(filter-out $(WARNINGS),$(CXXFLAGS)) -I $(GTEST_DIR) \

include/libpy/abi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ struct abi_version {
1717
LIBPY_EXPORT std::ostream& operator<<(std::ostream&, abi_version);
1818

1919
namespace detail {
20-
constexpr abi_version header_libpy_abi_version{0, 2, 0};
20+
constexpr abi_version header_libpy_abi_version{LIBPY_MAJOR_VERSION,
21+
LIBPY_MINOR_VERSION,
22+
LIBPY_MICRO_VERSION};
2123
} // namespace detail
2224

2325
/** The version of the libpy shared object.

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,21 @@ class BuildFailed(Exception):
3030
setup(
3131
name='libpy',
3232
url='https://github.com/quantopian/libpy',
33-
version='0.1.0',
33+
version=open('version').read().strip(),
3434
author='Quantopian Inc.',
3535
author_email='[email protected]',
36-
packages=find_packages(),
36+
packages=['libpy'],
3737
license='Apache 2.0',
3838
classifiers=[
3939
'Development Status :: 4 - Beta',
4040
'License :: OSI Approved :: Apache Software License',
4141
'Natural Language :: English',
4242
'Topic :: Software Development',
4343
'Programming Language :: Python',
44-
'Programming Language :: Python :: 2.7',
44+
'Programming Language :: Python :: 3.5',
4545
'Programming Language :: Python :: 3.6',
46+
'Programming Language :: Python :: 3.7',
47+
'Programming Language :: Python :: 3.8',
4648
'Programming Language :: Python :: Implementation :: CPython',
4749
'Programming Language :: C++',
4850
'Operating System :: POSIX',

version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2.0

0 commit comments

Comments
 (0)