[fix] change in versioning: store __version__ in __init__.py

This commit is contained in:
Anand Doshi 2016-06-09 16:07:09 +05:30
parent 7899fc9f6e
commit 684c8a3e2f
5 changed files with 29 additions and 9 deletions

View file

@ -11,10 +11,10 @@ from functools import wraps
import os, importlib, inspect, logging, json import os, importlib, inspect, logging, json
# public # public
from frappe.__version__ import __version__
from .exceptions import * from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template from .utils.jinja import get_jenv, get_template, render_template
__version__ = "6.27.21"
local = Local() local = Local()

View file

@ -1,2 +0,0 @@
from __future__ import unicode_literals
__version__ = "6.27.21"

View file

@ -1,11 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "frappe" app_name = "frappe"
app_title = "Frappe Framework" app_title = "Frappe Framework"
app_publisher = "Frappe Technologies" app_publisher = "Frappe Technologies"
app_description = "Full stack web framework with Python, Javascript, MariaDB, Redis, Node" app_description = "Full stack web framework with Python, Javascript, MariaDB, Redis, Node"
app_icon = "octicon octicon-circuit-board" app_icon = "octicon octicon-circuit-board"
app_version = "6.27.21"
app_color = "orange" app_color = "orange"
source_link = "https://github.com/frappe/frappe" source_link = "https://github.com/frappe/frappe"
app_license = "MIT" app_license = "MIT"

View file

@ -53,7 +53,8 @@ def make_boilerplate(dest, app_name):
"includes")) "includes"))
frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, "config"), with_init=True) frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, "config"), with_init=True)
touch_file(os.path.join(dest, hooks.app_name, hooks.app_name, "__init__.py")) with open(os.path.join(dest, hooks.app_name, hooks.app_name, "__init__.py"), "w") as f:
f.write(encode(init_template))
with open(os.path.join(dest, hooks.app_name, "MANIFEST.in"), "w") as f: with open(os.path.join(dest, hooks.app_name, "MANIFEST.in"), "w") as f:
f.write(encode(manifest_template.format(**hooks))) f.write(encode(manifest_template.format(**hooks)))
@ -110,8 +111,16 @@ recursive-include {app_name} *.svg
recursive-include {app_name} *.txt recursive-include {app_name} *.txt
recursive-exclude {app_name} *.pyc""" recursive-exclude {app_name} *.pyc"""
init_template = """# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__version__ = '0.0.1'
"""
hooks_template = """# -*- coding: utf-8 -*- hooks_template = """# -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "{app_name}" app_name = "{app_name}"
app_title = "{app_title}" app_title = "{app_title}"
@ -120,7 +129,6 @@ app_description = "{app_description}"
app_icon = "{app_icon}" app_icon = "{app_icon}"
app_color = "{app_color}" app_color = "{app_color}"
app_email = "{app_email}" app_email = "{app_email}"
app_version = "0.0.1"
app_license = "{app_license}" app_license = "{app_license}"
# Includes in <head> # Includes in <head>
@ -244,8 +252,15 @@ def get_data():
setup_template = """# -*- coding: utf-8 -*- setup_template = """# -*- coding: utf-8 -*-
from setuptools import setup, find_packages from setuptools import setup, find_packages
from pip.req import parse_requirements from pip.req import parse_requirements
import re, ast
# get version from __version__ variable in {app_name}/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('{app_name}/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
version = '0.0.1'
requirements = parse_requirements("requirements.txt", session="") requirements = parse_requirements("requirements.txt", session="")
setup( setup(

View file

@ -1,7 +1,14 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
from pip.req import parse_requirements from pip.req import parse_requirements
import re, ast
# get version from __version__ variable in frappe/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('frappe/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
version = "6.27.21"
requirements = parse_requirements("requirements.txt", session="") requirements = parse_requirements("requirements.txt", session="")
setup( setup(