Skip to content

Commit 418af80

Browse files
author
Joe Riley
committed
Got rid of VERSION and made version.py the source of version truth
1 parent dfb2edc commit 418af80

File tree

5 files changed

+29
-31
lines changed

5 files changed

+29
-31
lines changed

MANIFEST

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ src/DatabaseLibrary/__init__.py
33
src/DatabaseLibrary/assertion.py
44
src/DatabaseLibrary/connection_manager.py
55
src/DatabaseLibrary/query.py
6+
src/DatabaseLibrary/version.py

setup.py

+25-28
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,28 @@
1717

1818
"""Setup script for Robot's DatabaseLibrary distributions"""
1919

20-
from distutils.core import setup
21-
22-
import setuptools
23-
import sys
24-
import os
25-
26-
src_path = os.path.join(os.path.dirname(__file__), 'src')
27-
sys.path.insert(0, src_path)
28-
29-
__version_file_path__ = os.path.join(src_path, 'DatabaseLibrary', 'VERSION')
30-
__version__ = open(__version_file_path__, 'r').read().strip()
31-
32-
def main():
33-
setup(name = 'robotframework-databaselibrary',
34-
version = __version__,
35-
description = 'Database utility library for Robot Framework',
36-
author = 'Franz Allan Valencia See',
37-
author_email = '[email protected]',
38-
url = 'https://github.com/franz-see/Robotframework-Database-Library',
39-
package_dir = { '' : 'src'},
40-
packages = ['DatabaseLibrary'],
41-
package_data = {'DatabaseLibrary': ['VERSION']},
42-
requires = ['robotframework']
43-
)
44-
45-
46-
if __name__ == "__main__":
47-
main()
20+
from os.path import abspath, dirname, join
21+
22+
try:
23+
from setuptools import setup
24+
except ImportError as error:
25+
from distutils.core import setup
26+
27+
28+
version_file = join(dirname(abspath(__file__)), 'src', 'DatabaseLibrary', 'version.py')
29+
30+
with open(version_file) as file:
31+
code = compile(file.read(), version_file, 'exec')
32+
exec(code)
33+
34+
setup(name = 'robotframework-databaselibrary',
35+
version = VERSION,
36+
description = 'Database utility library for Robot Framework',
37+
author = 'Franz Allan Valencia See',
38+
author_email = '[email protected]',
39+
url = 'https://github.com/franz-see/Robotframework-Database-Library',
40+
package_dir = { '' : 'src'},
41+
packages = ['DatabaseLibrary'],
42+
package_data = {'DatabaseLibrary': []},
43+
requires = ['robotframework']
44+
)

src/DatabaseLibrary/VERSION

-1
This file was deleted.

src/DatabaseLibrary/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
from DatabaseLibrary.connection_manager import ConnectionManager
1818
from DatabaseLibrary.query import Query
1919
from DatabaseLibrary.assertion import Assertion
20+
from DatabaseLibrary.version import VERSION
2021

21-
__version_file_path__ = os.path.join(os.path.dirname(__file__), 'VERSION')
22-
__version__ = open(__version_file_path__, 'r').read().strip()
22+
_version_ = VERSION
2323

2424
class DatabaseLibrary(ConnectionManager, Query, Assertion):
2525
"""

src/DatabaseLibrary/version.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = '1.2.1'

0 commit comments

Comments
 (0)