Skip to content

Commit

Permalink
Update Versioning Scheme (#651)
Browse files Browse the repository at this point in the history
* Update versioning scheme to 3 semver digits

* Fix version indexing

Co-authored-by: Hannah Stepanek <[email protected]>
Co-authored-by: Lalleh Rafeei <[email protected]>

* Remove version truncation

* [Mega-Linter] Apply linters fixes

* Bump tests

Co-authored-by: Hannah Stepanek <[email protected]>
Co-authored-by: Lalleh Rafeei <[email protected]>
Co-authored-by: TimPansino <[email protected]>
  • Loading branch information
4 people authored Oct 10, 2022
1 parent f007904 commit 9a56f3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 4 additions & 3 deletions newrelic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
# limitations under the License.

import os.path

THIS_DIR = os.path.dirname(__file__)

try:
with open(os.path.join(THIS_DIR, 'version.txt'), 'r') as f:
with open(os.path.join(THIS_DIR, "version.txt"), "r") as f:
version = f.read()
except:
version = '0.0.0.0'
version = "0.0.0"

version_info = list(map(int, version.split('.')))
version_info = list(map(int, version.split(".")))
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@
def newrelic_agent_guess_next_version(tag_version):
version, _, _ = str(tag_version).partition("+")
version_info = list(map(int, version.split(".")))
if len(version_info) < 4:
if len(version_info) < 3:
return version
version_info[1] += 1
if version_info[1] % 2:
version_info[3] = 0
else:
version_info[3] += 1
version_info[2] = 0
return ".".join(map(str, version_info))


Expand Down Expand Up @@ -134,7 +131,7 @@ def build_extension(self, ext):
use_scm_version={
"version_scheme": newrelic_agent_next_version,
"local_scheme": "no-local-version",
"git_describe_command": "git describe --dirty --tags --long --match *.*.*.*",
"git_describe_command": "git describe --dirty --tags --long --match *.*.*",
"write_to": "newrelic/version.txt",
},
setup_requires=["setuptools_scm>=3.2,<7"],
Expand Down

0 comments on commit 9a56f3a

Please sign in to comment.