Skip to content

Commit

Permalink
Fix: change how to specify path
Browse files Browse the repository at this point in the history
Signed-off-by: h-suzuki <h-suzuki@isp.co.jp>
  • Loading branch information
h-suzuki-isp committed Feb 5, 2024
1 parent d71dd1b commit c978bb5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ros2caret/verb/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@
class CaretVersionVerb(VerbExtension):

def main(self, *, args):
version_path = '../../setup.py'
version = self.get_version(version_path)
version = self.get_version()
print('v' + version)

def get_version(self, rel_path):
here_path = os.path.dirname(os.path.realpath(__file__))
path = os.path.join(here_path, rel_path)
def get_version(self):
path = f'{os.path.dirname(os.path.realpath(__file__))}/../../setup.py'
version_pattern = re.compile(r"\s*version\s*=\s*['\"](\d+\.\d+\.\d+)['\"]")
with open(path) as f:
for line in f:
Expand Down

0 comments on commit c978bb5

Please sign in to comment.