Skip to content

Commit

Permalink
switched to static version numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
P-T-I committed Apr 12, 2024
1 parent 6561581 commit 2e7dea0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 111 deletions.
1 change: 0 additions & 1 deletion CveXplore/VERSION

This file was deleted.

7 changes: 0 additions & 7 deletions CveXplore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
from CveXplore.main import CveXplore

try:
from version import _version

_version()
except ModuleNotFoundError:
pass
11 changes: 2 additions & 9 deletions CveXplore/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
====
"""

VERSION = __version__ = "0.3.27"

import os
import shutil

Expand Down Expand Up @@ -51,15 +53,6 @@
from CveXplore.objects.cvexplore_object import CveXploreObject


try:
from version import VERSION
except ModuleNotFoundError:
_PKG_DIR = os.path.dirname(__file__)
version_file = os.path.join(_PKG_DIR, "VERSION")
with open(version_file, "r") as fdsec:
VERSION = fdsec.read()


class CveXplore(object):
"""
Main class for CveXplore package
Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

from setuptools import setup, find_packages

try:
from version import VERSION
except ModuleNotFoundError:
_PKG_DIR = os.path.dirname(__file__)
version_file = os.path.join(_PKG_DIR, "CveXplore", "VERSION")
with open(version_file, "r") as fdsec:
VERSION = fdsec.read()
from CveXplore.main import VERSION

This comment has been minimized.

Copy link
@oh2fih

oh2fih Apr 12, 2024

Collaborator

Quick last minute changes, what could go wrong... This causes setup.py to import CveXplore/__init__.py which then imports the entire CveXplore.main, not just a single variable... This has unexpected consequences with, e.g., pybuild:

dh_auto_configure
I: pybuild base:239: python3.10 setup.py config 
Traceback (most recent call last):
  File "./setup.py", line 6, in <module>
    from CveXplore.main import VERSION
  File "./CveXplore/__init__.py", line 1, in <module>
    from CveXplore.main import CveXplore
  File "./CveXplore/main.py", line 11, in <module>
    from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
E: pybuild pybuild:369: configure: plugin distutils failed with: exit code=1: python3.10 setup.py config 
dh_auto_configure: error: pybuild --configure -i python{version} -p 3.10 returned exit code 13
make[2]: *** [debian/rules:14: override_dh_auto_configure] Error 13

@P-T-I This could be fixed by catching the except ModuleNotFoundError: like it used to be, but parsing the version from CveXplore/main.py instead of using the CveXplore/VERSION file. Or even better, just directly parsing it, because setup.py really shouldn't import the entire project. It could actually be best to keep the VERSION file but simply read it without trying to git describe.

This comment has been minimized.

Copy link
@oh2fih

oh2fih Apr 12, 2024

Collaborator

Attempted fix in #275


# The directory containing this file
HERE = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -113,7 +107,6 @@ def extras_require():
package_data={
"CveXplore": [
"LICENSE",
"VERSION",
".schema_version",
"common/.sources.ini",
"common/.env_example",
Expand Down
86 changes: 0 additions & 86 deletions version.py

This file was deleted.

0 comments on commit 2e7dea0

Please sign in to comment.