changeset 2571:4aca060075b7

setup: version is now set in SAT/VERSION, sat is not imported anymore in setup
author Goffi <goffi@goffi.org>
date Thu, 05 Apr 2018 10:41:08 +0200
parents 2ac37dfc408b
children 7e7f4e344a96
files MANIFEST.in sat/VERSION sat/__init__.py sat/core/constants.py setup.py
diffstat 5 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MANIFEST.in	Wed Apr 04 22:09:20 2018 +0200
+++ b/MANIFEST.in	Thu Apr 05 10:41:08 2018 +0200
@@ -1,4 +1,4 @@
-include MANIFEST.in ez_setup.py
+include MANIFEST.in sat/VERSION
 global-include *.py
 global-include *.ini
 global-include *.po *.mo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sat/VERSION	Thu Apr 05 10:41:08 2018 +0200
@@ -0,0 +1,1 @@
+0.7.0D
--- a/sat/__init__.py	Wed Apr 04 22:09:20 2018 +0200
+++ b/sat/__init__.py	Thu Apr 05 10:41:08 2018 +0200
@@ -1,3 +1,23 @@
-from .core.constants import Const as C
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# SàT: a XMPP client
+# Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org)
+
+# 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.
 
-__version__ = C.APP_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 os.path
+
+version_file = os.path.join(os.path.dirname(__file__), 'VERSION')
+with open(version_file) as f:
+    __version__ = f.read().strip()
--- a/sat/core/constants.py	Wed Apr 04 22:09:20 2018 +0200
+++ b/sat/core/constants.py	Thu Apr 05 10:41:08 2018 +0200
@@ -22,6 +22,7 @@
     from os.path import expanduser, realpath
 except ImportError:
     BaseDirectory = None
+import sat
 
 
 class Const(object):
@@ -32,7 +33,7 @@
     APP_NAME_FILE = u'sat'
     APP_NAME_FULL = u'{name_short} ({name})'.format(name_short=APP_NAME_SHORT,
                                                     name=APP_NAME)
-    APP_VERSION = u'0.7.0D'  # Please add 'D' at the end for dev versions
+    APP_VERSION = sat.__version__  # Please add 'D' at the end of version in sat/VERSION for dev versions
     APP_RELEASE_NAME = u'La Commune'
     APP_URL = u'https://salut-a-toi.org'
 
--- a/setup.py	Wed Apr 04 22:09:20 2018 +0200
+++ b/setup.py	Thu Apr 05 10:41:08 2018 +0200
@@ -19,7 +19,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from setuptools import setup, find_packages
-from sat.core.constants import Const as C
 import os
 import sys
 
@@ -55,15 +54,17 @@
 
 DBUS_DIR = 'dbus-1/services'
 DBUS_FILE = 'misc/org.goffi.SAT.service'
+with open('sat/VERSION') as f:
+    VERSION = f.read().strip()
 
 
 setup(name=NAME,
-      version=C.APP_VERSION,
+      version=VERSION,
       description=u'Salut à Toi multipurpose and multi frontend XMPP client',
       long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend architecture. Its multi frontend (desktop, web, console interface, CLI, etc) and multipurpose (instant messaging, microblogging, games, file sharing, etc).',
       author='Association « Salut à Toi »',
       author_email='contact@goffi.org',
-      url=C.APP_URL,
+      url='https://salut-a-toi.org',
       classifiers=['Development Status :: 3 - Alpha',
                    'Environment :: Console',
                    'Framework :: Twisted',
@@ -78,5 +79,6 @@
       scripts=['sat_frontends/jp/jp', 'sat_frontends/primitivus/primitivus', 'bin/sat'],
       zip_safe=False,
       install_requires=install_requires,
+      package_data={'sat': ['VERSION']},
       python_requires='~=2.7',
       )