The build string is now part of the mayan package metadata. Update forum link. Add instagram link.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
13
__init__.py.tmpl
Normal file
13
__init__.py.tmpl
Normal file
@@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__title__ = 'Mayan EDMS'
|
||||
__version__ = '{{ version }}'
|
||||
__build__ = 0x030100
|
||||
__build_string__ = '{{ build_string }}'
|
||||
__author__ = 'Roberto Rosario'
|
||||
__author_email__ = 'roberto.rosario@mayan-edms.com'
|
||||
__description__ = 'Free Open Source Electronic Document Management System'
|
||||
__license__ = 'Apache 2.0'
|
||||
__copyright_short__ = '2011-2018 Roberto Rosario'
|
||||
__copyright__ = '{} {}'.format('Copyright', __copyright_short__)
|
||||
__website__ = 'https://www.mayan-edms.com'
|
||||
@@ -4,14 +4,44 @@ from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
|
||||
from dateutil import parser
|
||||
import sh
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.template import Template, Context
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
import mayan
|
||||
|
||||
try:
|
||||
BUILD = sh.Command('git').bake('describe', '--tags', '--always', 'HEAD')
|
||||
DATE = sh.Command('git').bake('--no-pager', 'log', '-1', '--format=%cd')
|
||||
except sh.CommandNotFound:
|
||||
BUILD = None
|
||||
DATE = None
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
REQUIREMENTS_FILE = 'requirements.txt'
|
||||
SETUP_TEMPLATE = 'setup.py.tmpl'
|
||||
MAYAN_TEMPLATE = '__init__.py.tmpl'
|
||||
|
||||
|
||||
def generate_build_number():
|
||||
if BUILD and DATE:
|
||||
try:
|
||||
result = '{} {}'.format(BUILD(), DATE()).replace('\n', '')
|
||||
except sh.ErrorReturnCode_128:
|
||||
result = ''
|
||||
else:
|
||||
result = ''
|
||||
return result
|
||||
|
||||
|
||||
def generate_commit_timestamp():
|
||||
datetime = parser.parse(force_text(DATE()))
|
||||
return datetime.strftime('%y%m%d%H%M')
|
||||
|
||||
|
||||
def get_requirements(base_directory, filename):
|
||||
@@ -49,3 +79,24 @@ if __name__ == '__main__':
|
||||
|
||||
with open('setup.py', 'w') as file_object:
|
||||
file_object.write(result)
|
||||
|
||||
with open(MAYAN_TEMPLATE) as file_object:
|
||||
template = file_object.read()
|
||||
|
||||
# Ignore local version if any
|
||||
upstream_version = '.'.join(
|
||||
mayan.__version__.split('+')[0].split('.')
|
||||
)
|
||||
|
||||
result = Template(template).render(
|
||||
context=Context(
|
||||
{
|
||||
'build_string': generate_build_number(),
|
||||
'timestamp': generate_commit_timestamp(),
|
||||
'version': upstream_version
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
with open(os.path.join(BASE_DIR, 'mayan', '__init__.py'), 'w') as file_object:
|
||||
file_object.write(result)
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
__title__ = 'Mayan EDMS'
|
||||
__version__ = '3.1b2'
|
||||
__build__ = 0x030100
|
||||
__build_string__ = 'v3.0.3-225-g632f4b598 Fri Sep 14 00:21:02 2018 -0400'
|
||||
__author__ = 'Roberto Rosario'
|
||||
__author_email__ = 'roberto.rosario@mayan-edms.com'
|
||||
__description__ = 'Free Open Source Electronic Document Management System'
|
||||
@@ -10,4 +11,3 @@ __license__ = 'Apache 2.0'
|
||||
__copyright_short__ = '2011-2018 Roberto Rosario'
|
||||
__copyright__ = '{} {}'.format('Copyright', __copyright_short__)
|
||||
__website__ = 'https://www.mayan-edms.com'
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
{% endblock stylesheets %}
|
||||
|
||||
{% block content %}
|
||||
{% build as build_number %}
|
||||
{% project_information '__build_string__' as build_number %}
|
||||
{% smart_setting 'COMMON_PROJECT_TITLE' as setting_project_title %}
|
||||
{% project_information '__title__' as project_title %}
|
||||
|
||||
@@ -102,11 +102,11 @@
|
||||
</p>
|
||||
|
||||
<p class="text-center">
|
||||
If you found a bug or got a feature idea, visit the <a class="new_window" href="https://groups.google.com/forum/#!forum/mayan-edms">forum <i class="far fa-life-ring"></i></a> or open a ticket in the <a class="new_window" href="https://gitlab.com/mayan-edms/mayan-edms">GitLab repository <i class="fab fa-gitlab"></i></a>.
|
||||
If you found a bug or got a feature idea, visit the <a class="new_window" href="https://forum.mayan-edms.com">forum <i class="far fa-life-ring"></i></a> or open a ticket in the <a class="new_window" href="https://gitlab.com/mayan-edms/mayan-edms">GitLab repository <i class="fab fa-gitlab"></i></a>.
|
||||
</p>
|
||||
<p class="text-center">
|
||||
Spread the word. Talk to your friends and colleagues about how awesome {% project_information '__title__' %} is!
|
||||
Follow us on <a class="new_window" href="https://twitter.com/mayanedms">Twitter <i class="fab fa-twitter"></i></a> or <a class="new_window" href="https://www.facebook.com/MayanEDMS/">Facebook <i class="fab fa-facebook"></i></a>
|
||||
Follow us on <a class="new_window" href="https://twitter.com/mayanedms">Twitter <i class="fab fa-twitter"></i></a>, <a class="new_window" href="https://www.facebook.com/MayanEDMS/">Facebook <i class="fab fa-facebook"></i></a>, or <a class="new_window" href="https://www.instagram.com/mayan_edms/">Instagram <i class="fab fa-instagram"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -2,8 +2,6 @@ from __future__ import unicode_literals
|
||||
|
||||
from json import dumps
|
||||
|
||||
import sh
|
||||
|
||||
from django.template import Context, Library
|
||||
from django.template.loader import get_template
|
||||
from django.utils.encoding import force_text
|
||||
@@ -16,24 +14,6 @@ from ..utils import check_for_sqlite, return_attrib
|
||||
|
||||
register = Library()
|
||||
|
||||
try:
|
||||
BUILD = sh.Command('git').bake('describe', '--tags', '--always', 'HEAD')
|
||||
DATE = sh.Command('git').bake('--no-pager', 'log', '-1', '--format=%cd')
|
||||
except sh.CommandNotFound:
|
||||
BUILD = None
|
||||
DATE = None
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def build():
|
||||
if BUILD:
|
||||
try:
|
||||
return '{} {}'.format(BUILD(), DATE())
|
||||
except sh.ErrorReturnCode_128:
|
||||
return ''
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def check_sqlite():
|
||||
|
||||
Reference in New Issue
Block a user