From 227b238fb18c6695f3281fcd9615f92773dc89fe Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 Jun 2016 16:29:12 +0530 Subject: [PATCH] [fix] change in versioning: store __version__ in __init__.py --- erpnext/__init__.py | 8 +++++--- erpnext/__version__.py | 2 -- erpnext/hooks.py | 2 +- setup.py | 10 +++++++++- 4 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 erpnext/__version__.py diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5324cde537..81f50ef03a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -1,7 +1,9 @@ -from erpnext.__version__ import __version__ - +# -*- coding: utf-8 -*- +from __future__ import unicode_literals import frappe +__version__ = '6.27.22' + def get_default_company(user=None): '''Get default company for user''' from frappe.defaults import get_user_default_as_list @@ -21,4 +23,4 @@ def get_default_currency(): '''Returns the currency of the default company''' company = get_default_company() if company: - return frappe.db.get_value('Company', company, 'default_currency') \ No newline at end of file + return frappe.db.get_value('Company', company, 'default_currency') diff --git a/erpnext/__version__.py b/erpnext/__version__.py deleted file mode 100644 index c27ae20f2a..0000000000 --- a/erpnext/__version__.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -__version__ = '6.27.22' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 1b130a635e..2bb2ca6065 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals from frappe import _ +from . import __version__ as app_version app_name = "erpnext" app_title = "ERPNext" @@ -7,7 +8,6 @@ app_publisher = "Frappe Technologies Pvt. Ltd." app_description = """ERP made simple""" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.27.22" app_email = "info@erpnext.com" app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" diff --git a/setup.py b/setup.py index d592c5f3cd..5dd87abb5b 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,15 @@ +# -*- coding: utf-8 -*- from setuptools import setup, find_packages from pip.req import parse_requirements +import re, ast + +# get version from __version__ variable in erpnext/__init__.py +_version_re = re.compile(r'__version__\s+=\s+(.*)') + +with open('erpnext/__init__.py', 'rb') as f: + version = str(ast.literal_eval(_version_re.search( + f.read().decode('utf-8')).group(1))) -version = "6.27.22" requirements = parse_requirements("requirements.txt", session="") setup(