Skip to content

Commit

Permalink
Merge pull request #215 from jburel/version-simplify
Browse files Browse the repository at this point in the history
Version simplify
  • Loading branch information
jburel committed Jun 21, 2017
2 parents 5a43c3a + 496febb commit 928d221
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 24 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
@@ -1,3 +1,3 @@
include README.rst
include LICENSE
recursive-include omero_figure *
recursive-include omero_figure *
22 changes: 21 additions & 1 deletion omero_figure/settings.py
@@ -1,8 +1,28 @@
#
# Copyright (c) 2017 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# This settings.py file will be imported by omero.settings file AFTER it has
# initialised custom settings.
# See "App Settings" on
# https://www.openmicroscopy.org/
# site/support/omero5.3/developers/Web/CreateApp.html

OMERO_FIGURE_VERSION = "3.0.0"
from . import utils
import warnings

warnings.warn("Deprecated. utils.__version__", DeprecationWarning)
OMERO_FIGURE_VERSION = utils.__version__
33 changes: 33 additions & 0 deletions omero_figure/utils.py
@@ -0,0 +1,33 @@
#
# Copyright (c) 2017 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#


import json
import os


__version__ = "3.0.0"


def read_file(fname, content_type=None):
p = os.path.abspath(fname)
with open(p) as f:
if content_type in ('json',):
data = json.load(f)
else:
data = f.read()
return data
6 changes: 2 additions & 4 deletions omero_figure/views.py
Expand Up @@ -34,7 +34,7 @@

from omeroweb.webclient.decorators import login_required

from . import settings
from . import utils

try:
from PIL import Image
Expand Down Expand Up @@ -109,16 +109,14 @@ def index(request, file_id=None, conn=None, **kwargs):
and lay them out in canvas by dragging & resizing etc
"""

version = settings.OMERO_FIGURE_VERSION

script_service = conn.getScriptService()
sid = script_service.getScriptID(SCRIPT_PATH)
script_missing = sid <= 0
user_full_name = conn.getUser().getFullName()

context = {'scriptMissing': script_missing,
'userFullName': user_full_name,
'version': version}
'version': utils.__version__}
return render(request, "figure/index.html", context)


Expand Down
3 changes: 2 additions & 1 deletion package.json
@@ -1,6 +1,7 @@
{
"name": "omero-figure",
"version": "3.0.0",
"//": "Required to build but not used. See omero_figure/utils.py for version",
"version": "0.0.0",
"description": "OMERO figure creation app",
"main": "index.js",
"scripts": {
Expand Down
21 changes: 4 additions & 17 deletions setup.py
Expand Up @@ -20,29 +20,16 @@
#
# Version: 1.0


import json
import os
import setuptools.command.install
import setuptools.command.develop
import setuptools.command.sdist
from distutils.core import Command
from setuptools import setup, find_packages
import omero_figure.utils as utils

VERSION = utils.__version__

# Utility function to read the README file. Also support json content
def read_file(fname, content_type=None):
dir_path = os.path.dirname(os.path.realpath(__file__))
p = os.path.join(dir_path, fname)
with open(p) as f:
if content_type in ('json',):
data = json.load(f)
else:
data = f.read()
return data


VERSION = "3.0.0"
DESCRIPTION = "OMERO figure creation app"
AUTHOR = "The Open Microscopy Team"
LICENSE = "AGPL-3.0"
Expand Down Expand Up @@ -135,7 +122,7 @@ def run(self):
packages=find_packages(exclude=['ez_setup']),
version=VERSION,
description=DESCRIPTION,
long_description=read_file('README.rst'),
long_description=utils.read_file('README.rst'),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
Expand All @@ -159,7 +146,7 @@ def run(self):
author_email='ome-devel@lists.openmicroscopy.org.uk',
license=LICENSE,
url=HOMEPAGE,
download_url='https://github.com/ome/omero-figure/tarball/%s' % VERSION,
download_url='%s/archive/v%s.tar.gz' % (HOMEPAGE, VERSION),
keywords=['OMERO.web', 'figure'],
install_requires=[],
include_package_data=True,
Expand Down

0 comments on commit 928d221

Please sign in to comment.