Extract the version from init.py
@@ -2,17 +2,25 @@ import codecs
import os
from subprocess import call
-try:
from setuptools import setup, find_packages
-except ImportError:
- from distutils.core import setup, find_packages
+
from setuptools.command.develop import develop
from setuptools.command.install import install
-from owtf import __version__
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
+# Extracts the version details
+def get_version(init_path):
+ # Read the __init__ file
+ with open(init_path, "r+") as f:
+ init_page = f.read()
+ # Extract the version from the init file
+ for each_line in init_page.splitlines():
+ if each_line.startswith("__version__"):
+ delimiter = '"' if '"' in each_line else "'"
+ return each_line.split(delimiter)[1]
+
def strip_comments(l):
return l.split("#", 1)[0].strip()
@@ -40,8 +48,11 @@ def reqs(*f):
return [req for subreq in _reqs(*f) for req in subreq]
+# Absolute path for README.md
+readme_md = read_me = os.path.join(ROOT_DIR, "README.md")
+
# Long description
-long_description = codecs.open("README.md", "r", "utf-8").read()
+long_description = codecs.open(os.path.abspath("README.md"), "r", "utf-8").read()
post_script = os.path.join(ROOT_DIR, "scripts/install.sh")
@@ -67,7 +78,7 @@ class PostInstallCommand(install):
setup(
name="owtf",
- version=__version__,
+ version=get_version("owtf/__init__.py"),
url="https://github.com/owtf/owtf",
license="BSD",
author="Abraham Aranguren",
