@@ -16,23 +16,38 @@ def required(requirements_file):
1616 if pkg .strip () and not pkg .startswith ("#" )]
1717
1818
19- with open ("README.md" , "r" ) as f :
20- long_description = f .read ()
2119
20+ with open (f"{ BASEDIR } /README.md" , "r" ) as f :
21+ long_description = f .read ()
2222
23- with open ("./version.py" , "r" , encoding = "utf-8" ) as v :
24- for line in v .readlines ():
25- if line .startswith ("__version__" ):
26- if '"' in line :
27- version = line .split ('"' )[1 ]
28- else :
29- version = line .split ("'" )[1 ]
23+ def get_version ():
24+ """ Find the version of the package"""
25+ version_file = os .path .join (BASEDIR , 'ovos_solver_failure_plugin' , 'version.py' )
26+ major , minor , build , alpha = (None , None , None , None )
27+ with open (version_file ) as f :
28+ for line in f :
29+ if 'VERSION_MAJOR' in line :
30+ major = line .split ('=' )[1 ].strip ()
31+ elif 'VERSION_MINOR' in line :
32+ minor = line .split ('=' )[1 ].strip ()
33+ elif 'VERSION_BUILD' in line :
34+ build = line .split ('=' )[1 ].strip ()
35+ elif 'VERSION_ALPHA' in line :
36+ alpha = line .split ('=' )[1 ].strip ()
37+
38+ if ((major and minor and build and alpha ) or
39+ '# END_VERSION_BLOCK' in line ):
40+ break
41+ version = f"{ major } .{ minor } .{ build } "
42+ if alpha and int (alpha ) > 0 :
43+ version += f"a{ alpha } "
44+ return version
3045
3146
3247PLUGIN_ENTRY_POINT = 'ovos-solver-failure-plugin=ovos_solver_failure_plugin:FailureSolver'
3348setup (
3449 name = 'ovos-solver-failure-plugin' ,
35- version = version ,
50+ version = get_version () ,
3651 description = 'A question solver plugin for ovos/neon/mycroft' ,
3752 url = 'https://github.com/OpenVoiceOS/ovos-solver-failure-plugin' ,
3853 author = 'jarbasai' ,
0 commit comments