From ac954f378d2153d6d39409144bd65f63fd406bc6 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 5 Apr 2018 10:41:08 +0200 Subject: [PATCH] setup: version is now set in SAT/VERSION, sat is not imported anymore in setup --- MANIFEST.in | 2 +- sat/VERSION | 1 + sat/__init__.py | 24 ++++++++++++++++++++++-- sat/core/constants.py | 3 ++- setup.py | 8 +++++--- 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 sat/VERSION diff --git a/MANIFEST.in b/MANIFEST.in index 6c42fbdb..14e53820 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/sat/VERSION b/sat/VERSION new file mode 100644 index 00000000..88b62aff --- /dev/null +++ b/sat/VERSION @@ -0,0 +1 @@ +0.7.0D diff --git a/sat/__init__.py b/sat/__init__.py index f44f4501..76b91fcf 100644 --- a/sat/__init__.py +++ b/sat/__init__.py @@ -1,3 +1,23 @@ -from .core.constants import Const as C +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- -__version__ = C.APP_VERSION +# 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. + +# 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 . +import os.path + +version_file = os.path.join(os.path.dirname(__file__), 'VERSION') +with open(version_file) as f: + __version__ = f.read().strip() diff --git a/sat/core/constants.py b/sat/core/constants.py index abdc2d99..c5070ae4 100644 --- a/sat/core/constants.py +++ b/sat/core/constants.py @@ -22,6 +22,7 @@ try: from os.path import expanduser, realpath except ImportError: BaseDirectory = None +import sat class Const(object): @@ -32,7 +33,7 @@ class Const(object): 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' diff --git a/setup.py b/setup.py index 2ac8423a..a7f60265 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ # along with this program. If not, see . from setuptools import setup, find_packages -from sat.core.constants import Const as C import os import sys @@ -55,15 +54,17 @@ install_requires = [ 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 @@ setup(name=NAME, 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', )