File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 2424
2525from distutils .command import build_ext
2626
27+ import xml .etree .ElementTree as ET
28+ from os .path import dirname , realpath , join
2729
2830def get_version ():
2931 # Get the pulsar version from pom.xml
30- command = '''cat ../../pom.xml | xmllint --format - | \\
31- sed "s/xmlns=\\ ".*\\ "//g" | xmllint --stream --pattern /project/version --debug - | \\
32- grep -A 2 "matches pattern" | grep text | sed "s/.* [0-9] //g"'''
33- process = subprocess .Popen (['bash' , '-c' , command ], stdout = subprocess .PIPE )
34- output , error = process .communicate ()
35- if error :
36- raise 'Failed to get version: ' + error
32+ TOP_LEVEL_PATH = dirname (dirname (dirname (realpath (__file__ ))))
33+ POM_PATH = join (TOP_LEVEL_PATH , 'pom.xml' )
34+ root = ET .XML (open (POM_PATH ).read ())
35+ version = root .find ('{http://maven.apache.org/POM/4.0.0}version' ).text .strip ()
3736
3837 # Strip the '-incubating' suffix, since it prevents the packages
3938 # from being uploaded into PyPI
40- return
4FBC
output . strip (). decode ( 'utf-8' , 'strict' ) .split ('-' )[0 ]
39+ return version .split ('-' )[0 ]
4140
4241
4342VERSION = get_version ()
You can’t perform that action at this time.
0 commit comments