Remove execfile from setup.py
issue4654 review6171003
This commit is contained in:
1 parent
8e73ae8fa0
commit
4e0b5d7040
9 files changed
+35
-40
No files matched your search
+3
-3
@@ -42,7 +42,7 @@ os.environ['UBUNTU_MENUPROXY'] = '0'
|
||||
# overlay-scrollbar breaks treeview height
|
||||
os.environ['LIBOVERLAY_SCROLLBAR'] = '0'
|
||||
|
||||
import tryton
|
||||
from tryton import client
|
||||
if '--profile' in sys.argv:
|
||||
import profile
|
||||
import pstats
|
||||
@@ -51,7 +51,7 @@ if '--profile' in sys.argv:
|
||||
sys.argv.remove('--profile')
|
||||
|
||||
statfile = tempfile.mkstemp(".stat", "tryton-")[1]
|
||||
profile.run('tryton.client.TrytonClient().run()', statfile)
|
||||
profile.run('client.TrytonClient().run()', statfile)
|
||||
s = pstats.Stats(statfile)
|
||||
s.sort_stats('cumulative').print_stats()
|
||||
s.sort_stats('call').print_stats()
|
||||
@@ -63,4 +63,4 @@ if '--profile' in sys.argv:
|
||||
os.remove(statfile)
|
||||
|
||||
else:
|
||||
tryton.client.TrytonClient().run()
|
||||
client.TrytonClient().run()
|
||||
@@ -121,27 +121,31 @@ elif sys.platform == 'darwin':
|
||||
},
|
||||
}
|
||||
|
||||
PACKAGE, VERSION, LICENSE, WEBSITE = None, None, None, None
|
||||
execfile(os.path.join('tryton', 'version.py'))
|
||||
|
||||
major_version, minor_version, _ = VERSION.split('.', 2)
|
||||
def get_version():
|
||||
init = read(os.path.join('tryton', '__init__.py'))
|
||||
return re.search('__version__ = "([0-9.]*)"', init).group(1)
|
||||
|
||||
version = get_version()
|
||||
major_version, minor_version, _ = version.split('.', 2)
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
name = 'tryton'
|
||||
|
||||
download_url = 'http://downloads.tryton.org/%s.%s/' % (
|
||||
major_version, minor_version)
|
||||
if minor_version % 2:
|
||||
VERSION = '%s.%s.dev0' % (major_version, minor_version)
|
||||
version = '%s.%s.dev0' % (major_version, minor_version)
|
||||
download_url = 'hg+http://hg.tryton.org/%s#egg=%s-%s' % (
|
||||
PACKAGE, PACKAGE, VERSION)
|
||||
name, name, version)
|
||||
|
||||
dist = setup(name=PACKAGE,
|
||||
version=VERSION,
|
||||
dist = setup(name=name,
|
||||
version=version,
|
||||
description='Tryton client',
|
||||
long_description=read('README'),
|
||||
author='Tryton',
|
||||
author_email='issue_tracker@tryton.org',
|
||||
url=WEBSITE,
|
||||
url='http://www.tryton.org/',
|
||||
download_url=download_url,
|
||||
keywords='business application ERP',
|
||||
packages=find_packages(),
|
||||
@@ -170,7 +174,7 @@ dist = setup(name=PACKAGE,
|
||||
'Topic :: Office/Business',
|
||||
],
|
||||
platforms='any',
|
||||
license=LICENSE,
|
||||
license='GPL-3',
|
||||
install_requires=[
|
||||
# "pygtk >= 2.6",
|
||||
"python-dateutil",
|
||||
@@ -264,10 +268,10 @@ if os.name == 'nt':
|
||||
makensis = find_makensis()
|
||||
if makensis:
|
||||
from subprocess import Popen
|
||||
Popen([makensis, "/DVERSION=" + VERSION,
|
||||
Popen([makensis, "/DVERSION=" + version,
|
||||
str(os.path.join(os.path.dirname(__file__),
|
||||
'setup.nsi'))]).wait()
|
||||
Popen([makensis, "/DVERSION=" + VERSION,
|
||||
Popen([makensis, "/DVERSION=" + version,
|
||||
str(os.path.join(os.path.dirname(__file__),
|
||||
'setup-single.nsi'))]).wait()
|
||||
else:
|
||||
@@ -412,9 +416,9 @@ elif sys.platform == 'darwin':
|
||||
shutil.copytree(os.path.join(os.path.dirname(__file__), 'doc'),
|
||||
doc_dist_dir)
|
||||
|
||||
dmg_file = os.path.join(os.path.dirname(__file__), 'tryton-' + VERSION
|
||||
dmg_file = os.path.join(os.path.dirname(__file__), 'tryton-' + version
|
||||
+ '.dmg')
|
||||
if os.path.isfile(dmg_file):
|
||||
os.remove(dmg_file)
|
||||
Popen(['hdiutil', 'create', dmg_file, '-volname', 'Tryton Client '
|
||||
+ VERSION, '-fs', 'HFS+', '-srcfolder', dist_dir]).wait()
|
||||
+ version, '-fs', 'HFS+', '-srcfolder', dist_dir]).wait()
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import client
|
||||
|
||||
__all__ = ['client']
|
||||
__version__ = "3.5.0"
|
||||
@@ -28,7 +28,7 @@ import threading
|
||||
import tryton.rpc as rpc
|
||||
import locale
|
||||
import socket
|
||||
from tryton.version import VERSION
|
||||
from tryton import __version__
|
||||
import thread
|
||||
import urllib
|
||||
from string import Template
|
||||
@@ -231,7 +231,7 @@ def test_server_version(host, port):
|
||||
version = rpc.server_version(host, port)
|
||||
if not version:
|
||||
return False
|
||||
return version.split('.')[:2] == VERSION.split('.')[:2]
|
||||
return version.split('.')[:2] == __version__.split('.')[:2]
|
||||
|
||||
|
||||
def refresh_dblist(host, port):
|
||||
|
||||
+5
-5
@@ -5,7 +5,6 @@ import ConfigParser
|
||||
import optparse
|
||||
import os
|
||||
import gettext
|
||||
from version import VERSION
|
||||
import logging
|
||||
import sys
|
||||
import locale
|
||||
@@ -13,6 +12,7 @@ import gtk
|
||||
import site
|
||||
|
||||
from tryton.exceptions import TrytonError
|
||||
from tryton import __version__
|
||||
|
||||
_ = gettext.gettext
|
||||
|
||||
@@ -26,9 +26,9 @@ def get_home_dir():
|
||||
def get_config_dir():
|
||||
if os.name == 'nt':
|
||||
return os.path.join(os.environ['APPDATA'], '.config', 'tryton',
|
||||
VERSION.rsplit('.', 1)[0])
|
||||
__version__.rsplit('.', 1)[0])
|
||||
return os.path.join(os.environ['HOME'], '.config', 'tryton',
|
||||
VERSION.rsplit('.', 1)[0])
|
||||
__version__.rsplit('.', 1)[0])
|
||||
if not os.path.isdir(get_config_dir()):
|
||||
os.makedirs(get_config_dir(), 0700)
|
||||
|
||||
@@ -37,7 +37,7 @@ class ConfigManager(object):
|
||||
"Config manager"
|
||||
|
||||
def __init__(self):
|
||||
short_version = '.'.join(VERSION.split('.', 2)[:2])
|
||||
short_version = '.'.join(__version__.split('.', 2)[:2])
|
||||
demo_server = 'demo%s.tryton.org' % short_version
|
||||
demo_database = 'demo%s' % short_version
|
||||
self.defaults = {
|
||||
@@ -76,7 +76,7 @@ class ConfigManager(object):
|
||||
self.arguments = []
|
||||
|
||||
def parse(self):
|
||||
parser = optparse.OptionParser(version=("Tryton %s" % VERSION),
|
||||
parser = optparse.OptionParser(version=("Tryton %s" % __version__),
|
||||
usage="Usage: %prog [options] [url]")
|
||||
parser.add_option("-c", "--config", dest="config",
|
||||
help=_("specify alternate config file"))
|
||||
|
||||
@@ -5,8 +5,8 @@ import gtk
|
||||
import gettext
|
||||
import webbrowser
|
||||
from tryton.config import TRYTON_ICON
|
||||
from tryton.version import VERSION, WEBSITE
|
||||
from tryton.common import get_toplevel_window
|
||||
from tryton import __version__
|
||||
|
||||
COPYRIGHT = '''\
|
||||
Copyright (C) 2010-2011 Nicolas Évrard.
|
||||
@@ -719,10 +719,10 @@ class About(object):
|
||||
self.win = gtk.AboutDialog()
|
||||
self.win.set_transient_for(parent)
|
||||
self.win.set_name('Tryton')
|
||||
self.win.set_version(VERSION)
|
||||
self.win.set_version(__version__)
|
||||
self.win.set_copyright(COPYRIGHT)
|
||||
self.win.set_license(LICENSE)
|
||||
self.win.set_website(WEBSITE)
|
||||
self.win.set_website('http://www.tryton.org/')
|
||||
self.win.set_authors(AUTHORS)
|
||||
self.win.set_logo(TRYTON_ICON)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import gobject
|
||||
import os
|
||||
import gettext
|
||||
|
||||
from tryton.version import VERSION
|
||||
from tryton import __version__
|
||||
import tryton.common as common
|
||||
from tryton.config import CONFIG, TRYTON_ICON, PIXMAPS_DIR, get_config_dir
|
||||
import tryton.rpc as rpc
|
||||
@@ -460,7 +460,7 @@ class DBLogin(object):
|
||||
self.profile_cfg = os.path.join(get_config_dir(), 'profiles.cfg')
|
||||
self.profiles = ConfigParser.SafeConfigParser({'port': '8000'})
|
||||
if not os.path.exists(self.profile_cfg):
|
||||
short_version = '.'.join(VERSION.split('.', 2)[:2])
|
||||
short_version = '.'.join(__version__.split('.', 2)[:2])
|
||||
name = 'demo%s.tryton.org' % short_version
|
||||
self.profiles.add_section(name)
|
||||
self.profiles.set(name, 'host', name)
|
||||
|
||||
+2
-3
@@ -4,7 +4,6 @@
|
||||
import os
|
||||
import locale
|
||||
import gettext
|
||||
from version import PACKAGE
|
||||
from tryton.config import CURRENT_DIR
|
||||
import logging
|
||||
import gtk
|
||||
@@ -182,8 +181,8 @@ def setlang(lang=None, locale_dict=None):
|
||||
_('Unable to set locale %s') % lang2 + '.' + encoding)
|
||||
|
||||
if os.path.isdir(locale_dir):
|
||||
gettext.bindtextdomain(PACKAGE, locale_dir)
|
||||
gettext.textdomain(PACKAGE)
|
||||
gettext.bindtextdomain('tryton', locale_dir)
|
||||
gettext.textdomain('tryton')
|
||||
|
||||
if locale_dict:
|
||||
conv = locale.localeconv()
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
PACKAGE = "tryton"
|
||||
VERSION = "3.5.0"
|
||||
LICENSE = "GPL-3"
|
||||
WEBSITE = "http://www.tryton.org/"
|
||||
Reference in new issue
Block a user