Skip to content

Commit ab958dc

Browse files
authored
Package driver as pure-python wheel for easier installation (#1063)
1 parent 9b47011 commit ab958dc

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

bin/dist-functions

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ function setup
121121
{
122122
ARGS="$*"
123123
rm -rf ${DIST} 2> /dev/null
124-
set_metadata_and_setup "neo4j-driver" "True" ${ARGS} # Legacy package; can be removed in 2.0
124+
set_metadata_and_setup "neo4j-driver" "True" ${ARGS} --sdist # Legacy package; can be removed in 2.0
125125
set_metadata_and_setup "neo4j" "False" ${ARGS}
126126
}

bin/make-dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ then
1111
exit 1
1212
else
1313
source "${ROOT}/bin/dist-functions"
14-
setup "${VERSION}" --sdist
14+
setup "${VERSION}"
1515
fi

bin/release

+16-4
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,25 @@ for PACKAGE in "neo4j-driver" "neo4j"; do
2424
NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")"
2525
if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz"
2626
then
27-
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz"
27+
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz"
2828
elif check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"; then
29-
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}.tar.gz"
29+
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}.tar.gz"
3030
else
31-
echo "Distribution file for ${PACKAGE} not found"
32-
exit 1
31+
echo "Source distribution file for ${PACKAGE} not found"
32+
exit 1
3333
fi
3434
done
3535

36+
NORMALIZED_PACKAGE="$(normalize_dist_name "neo4j")"
37+
if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl"
38+
then
39+
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl"
40+
elif check_file "${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"; then
41+
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"
42+
else
43+
echo "Wheel distribution file for ${PACKAGE} not found"
44+
exit 1
45+
fi
46+
47+
3648
twine upload ${TWINE_ARGS}

setup.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@
5858
""" + readme
5959

6060

61-
@contextmanager
62-
def changed_package_name(new_name):
61+
def change_project_name(new_name):
6362
with open("pyproject.toml", "a+") as fd:
6463
fd.seek(0)
6564
pyproject = tomlkit.parse(fd.read())
@@ -68,16 +67,16 @@ def changed_package_name(new_name):
6867
fd.seek(0)
6968
fd.truncate()
7069
tomlkit.dump(pyproject, fd)
70+
return old_name
7171

72-
yield
7372

74-
with open("pyproject.toml", "a+") as fd:
75-
fd.seek(0)
76-
pyproject = tomlkit.parse(fd.read())
77-
pyproject["project"]["name"] = old_name
78-
fd.seek(0)
79-
fd.truncate()
80-
tomlkit.dump(pyproject, fd)
73+
@contextmanager
74+
def changed_package_name(new_name):
75+
old_name = change_project_name(new_name)
76+
try:
77+
yield
78+
finally:
79+
change_project_name(old_name)
8180

8281

8382
with changed_package_name(package):

0 commit comments

Comments
 (0)