Skip to content

Package driver as pure-python wheel for easier installation #1063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/dist-functions
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ function setup
{
ARGS="$*"
rm -rf ${DIST} 2> /dev/null
set_metadata_and_setup "neo4j-driver" "True" ${ARGS} # Legacy package; can be removed in 2.0
set_metadata_and_setup "neo4j-driver" "True" ${ARGS} --sdist # Legacy package; can be removed in 2.0
set_metadata_and_setup "neo4j" "False" ${ARGS}
}
2 changes: 1 addition & 1 deletion bin/make-dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ then
exit 1
else
source "${ROOT}/bin/dist-functions"
setup "${VERSION}" --sdist
setup "${VERSION}"
fi
20 changes: 16 additions & 4 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,25 @@ for PACKAGE in "neo4j-driver" "neo4j"; do
NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")"
if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz"
then
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz"
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz"
elif check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"; then
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}.tar.gz"
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}.tar.gz"
else
echo "Distribution file for ${PACKAGE} not found"
exit 1
echo "Source distribution file for ${PACKAGE} not found"
exit 1
fi
done

NORMALIZED_PACKAGE="$(normalize_dist_name "neo4j")"
if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl"
then
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl"
elif check_file "${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"; then
TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"
else
echo "Wheel distribution file for ${PACKAGE} not found"
exit 1
fi


twine upload ${TWINE_ARGS}
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
""" + readme


@contextmanager
def changed_package_name(new_name):
def change_project_name(new_name):
with open("pyproject.toml", "a+") as fd:
fd.seek(0)
pyproject = tomlkit.parse(fd.read())
Expand All @@ -68,16 +67,16 @@ def changed_package_name(new_name):
fd.seek(0)
fd.truncate()
tomlkit.dump(pyproject, fd)
return old_name

yield

with open("pyproject.toml", "a+") as fd:
fd.seek(0)
pyproject = tomlkit.parse(fd.read())
pyproject["project"]["name"] = old_name
fd.seek(0)
fd.truncate()
tomlkit.dump(pyproject, fd)
@contextmanager
def changed_package_name(new_name):
old_name = change_project_name(new_name)
try:
yield
finally:
change_project_name(old_name)


with changed_package_name(package):
Expand Down