~ubuntu-branches/ubuntu/utopic/retext/utopic

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2014-07-26 12:38:59 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140726123859-49z5c24mluzkpui1
Tags: 5.0.0-1
* New upstream release.
* Update debian/copyright.
* Run upstream tests during build.
* Wrap-and-sort debian/control.
* Update debian/watch to point to PyPI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python3
2
2
 
3
 
VERSION = '4.1.3'
 
3
VERSION = '5.0.0'
4
4
 
5
5
long_description = '''\
6
6
ReText is simple text editor that supports Markdown and reStructuredText
10
10
import sys
11
11
from os.path import join
12
12
from distutils import log
13
 
from distutils.core import setup
 
13
from distutils.core import setup, Command
14
14
from distutils.command.build import build
15
15
from distutils.command.sdist import sdist
16
16
from distutils.command.install_scripts import install_scripts
18
18
from glob import glob
19
19
from warnings import filterwarnings
20
20
 
 
21
if sys.version_info[0] < 3:
 
22
        sys.exit('Error: Python 3.x is required.')
 
23
 
21
24
def build_translations():
22
25
        print('running build_translations')
23
26
        error = None
24
27
        for ts_file in glob(join('locale', '*.ts')):
25
28
                try:
26
29
                        check_call(('lrelease', ts_file))
27
 
                except OSError:
28
 
                        try:
29
 
                                check_call(('lrelease-qt4', ts_file))
30
 
                        except Exception as e:
31
 
                                error = e
 
30
                except Exception as e:
 
31
                        error = e
32
32
        if error:
33
33
                print('Failed to build translations:', error)
34
34
 
51
51
                        log.info('renaming %s to %s', file, file[:-3])
52
52
                        shutil.move(file, file[:-3])
53
53
 
 
54
class retext_test(Command):
 
55
        user_options = []
 
56
 
 
57
        def initialize_options(self): pass
 
58
        def finalize_options(self): pass
 
59
 
 
60
        def run(self):
 
61
                import tests
 
62
                oldargv, sys.argv = sys.argv, ['setup.py test', '-v']
 
63
                try:
 
64
                        tests.main(module=None)
 
65
                except SystemExit as e:
 
66
                        if e.code:
 
67
                                raise
 
68
                sys.argv = oldargv
 
69
 
54
70
if '--no-rename' in sys.argv:
55
71
        retext_install_scripts = install_scripts
56
72
        sys.argv.remove('--no-rename')
76
92
        'build': retext_build,
77
93
        'sdist': retext_sdist,
78
94
        'install_scripts': retext_install_scripts,
 
95
        'test': retext_test,
79
96
      },
80
97
      license='GPL 2+'
81
98
)