|
17 | 17 |
|
18 | 18 | """Setup script for Robot's DatabaseLibrary distributions"""
|
19 | 19 |
|
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 | + ) |
0 commit comments