From 955e6f1a5a5c95d4f91cd82819e222749557dea9 Mon Sep 17 00:00:00 2001
From: merlos <merlos@gmail.com>
Date: Tue, 5 Nov 2024 05:54:01 +0300
Subject: [PATCH] same for primero api

---
 primero-api/setup.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/primero-api/setup.py b/primero-api/setup.py
index edff8e0..c0a8f07 100644
--- a/primero-api/setup.py
+++ b/primero-api/setup.py
@@ -1,7 +1,17 @@
 from setuptools import setup, find_packages
 
+import os
+import re
+
 def get_version():
-    return (open('primero_api/VERSION').read().strip())
+    version_file = os.path.join(os.path.dirname(__file__), 'primero_api','version.py')
+    with open(version_file) as f:
+        version_line = f.read().strip()
+        version_match = re.match(r"^__version__ = '\"['\"]", version_line)
+        if version_match:
+            return version_match.group(1)
+        raise RuntimeError("Unable to find version string.")
+
 
 setup(
     name='primero-api',