Skip to content

Commit

Permalink
Merge pull request #341 from linode/dev
Browse files Browse the repository at this point in the history
Release v5.28.0
  • Loading branch information
lgarber-akamai authored Jan 10, 2023
2 parents 186f400 + 6dc1d5e commit 32a6456
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ build
dist
*.egg-info
linode-cli.sh
baked_version
data-2
data-3
.DS_STORE
Pipfile*
test/.env
.tmp*
MANIFEST
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include linodecli/data-3
include linodecli/oauth-landing-page.html
include linode-cli.sh
include baked_version
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ override SPEC = $(shell ./resolve_spec_url ${SPEC_VERSION})
endif

install: check-prerequisites requirements build
ls dist/ | xargs -I{} pip3 install --force dist/{}
pip3 install --force dist/*.whl

.PHONY: build
build: clean
python3 -m linodecli bake ${SPEC} --skip-config
cp data-3 linodecli/
python3 setup.py bdist_wheel --universal
python3 setup.py bdist_wheel
python3 setup.py sdist

.PHONY: requirements
requirements:
Expand All @@ -32,6 +33,6 @@ check-prerequisites:
.PHONY: clean
clean:
rm -f linodecli/data-*
rm -f linode-cli.sh
rm -f linode-cli.sh baked_version
rm -f data-*
rm -rf dist
34 changes: 33 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,41 @@ def get_version():
return subprocess.check_output(["./version"]).decode("utf-8").rstrip()


def get_baked_version():
"""
Attempts to read the version from the baked_version file
"""
with open("./baked_version", "r", encoding="utf-8") as f:
result = f.read()

return result


def bake_version(v):
"""
Writes the given version to the baked_version file
"""
with open("./baked_version", "w", encoding="utf-8") as f:
f.write(v)


# If there's already a baked version, use it rather than attempting
# to resolve the version from env.
# This is useful for installing from an SDist where the version
# cannot be dynamically resolved.
#
# NOTE: baked_version is deleted when running `make build` and `make install`,
# so it should always be recreated during the build process.
if path.isfile("baked_version"):
version = get_baked_version()
else:
# Otherwise, retrieve and bake the version as normal
version = get_version()
bake_version(version)

setup(
name="linode-cli",
version=get_version(),
version=version,
description="CLI for the Linode API",
long_description=long_description,
author="Linode",
Expand Down

0 comments on commit 32a6456

Please sign in to comment.