Skip to content

Commit

Permalink
fix: add dynamic version to egg_updater.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BenL-github committed Mar 20, 2022
1 parent 295b6d1 commit a32583d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 33 deletions.
64 changes: 32 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/python/black
rev: 22.1.0
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8

- repo: https://github.com/PyCQA/bandit
rev: 1.7.3
hooks:
- id: bandit
args: ["-c", "bandit.conf"]

- repo: https://github.com/jorisroovers/gitlint
rev: v0.17.0
hooks:
- id: gitlint
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/python/black
rev: 22.1.0
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8

- repo: https://github.com/PyCQA/bandit
rev: 1.7.3
hooks:
- id: bandit
args: ["-c", "bandit.conf"]

- repo: https://github.com/jorisroovers/gitlint
rev: v0.17.0
hooks:
- id: gitlint
9 changes: 8 additions & 1 deletion cve_bin_tool/egg_updater.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later

import ast
import os
import sys
from io import StringIO

from setuptools.dist import Distribution

with open(os.path.join("cve_bin_tool", "version.py")) as f:
for line in f:
if line.startswith("VERSION"):
VERSION = ast.literal_eval(line.strip().split("=")[-1].strip())
break


def IS_DEVELOP() -> bool:
return any(
Expand Down Expand Up @@ -35,7 +42,7 @@ def update_egg() -> None:
script_name="setup.py",
script_args=["egg_info"],
name="cve-bin-tool",
version="3.0",
version=VERSION,
entry_points={
"console_scripts": [
"cve-bin-tool = cve_bin_tool.cli:main",
Expand Down

0 comments on commit a32583d

Please sign in to comment.