~ubuntu-branches/ubuntu/precise/virtinst/precise-updates

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-01 15:40:11 UTC
  • mfrom: (1.3.16 experimental)
  • Revision ID: james.westby@ubuntu.com-20110201154011-op0nusgc240xajvb
Tags: 0.500.5-1ubuntu1
* Merge from debian experimental. Remaining changes:
  - debian/patches/9001_Ubuntu.patch:
     + Updated to add maverick and natty to OS list and enable virtio
       for them.
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch. (refreshed)
  - debian/control: added acl package to depends.
  - Demote virt-viewer to Suggests, as it's in universe.
  - Recommends libvirt-bin
* Removed patches:
  - debian/patches/9002-libvirt_disk_format.patch: Upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
from unittest import TextTestRunner, TestLoader
8
8
from glob import glob
9
9
from os.path import splitext, basename, join as pjoin
10
 
import os, sys
 
10
import os
 
11
import sys
11
12
 
12
 
pkgs = ['virtinst', 'virtconv', 'virtconv.parsers' ]
 
13
pkgs = ['virtinst', 'virtconv', 'virtconv.parsers']
13
14
 
14
15
datafiles = [('share/man/man1', ['man/en/virt-install.1',
15
16
                                 'man/en/virt-clone.1',
32
33
        self._dir = os.getcwd()
33
34
 
34
35
    def finalize_options(self):
35
 
        if self.debug and not os.environ.has_key("DEBUG_TESTS"):
 
36
        if self.debug and "DEBUG_TESTS" not in os.environ:
36
37
            os.environ["DEBUG_TESTS"] = "1"
37
38
 
38
39
    def run(self):
44
45
            use_coverage = False
45
46
 
46
47
        tests = TestLoader().loadTestsFromNames(self._testfiles)
47
 
        t = TextTestRunner(verbosity = 1)
 
48
        t = TextTestRunner(verbosity=1)
48
49
 
49
50
        if use_coverage:
50
51
            coverage.erase()
65
66
    description = "Runs a quick unit test suite"
66
67
    user_options = TestBaseCommand.user_options + \
67
68
                   [("testfile=", None, "Specific test file to run (e.g "
68
 
                                        "validation, storage, ...)"),]
 
69
                                        "validation, storage, ...)")]
69
70
 
70
71
    def initialize_options(self):
71
72
        TestBaseCommand.initialize_options(self)
101
102
 
102
103
    user_options = (TestBaseCommand.user_options +
103
104
                    [("prompt", None, "Run interactive CLI invocations."),
104
 
                    ("app=", None, "Only run tests for requested app")])
 
105
                    ("app=", None, "Only run tests for requested app"),
 
106
                    ("category=", None, "Only run tests for the requested "
 
107
                                       "category (install, storage, etc.)")])
105
108
 
106
109
    def initialize_options(self):
107
110
        TestBaseCommand.initialize_options(self)
108
111
        self.prompt = 0
109
112
        self.app = None
 
113
        self.category = None
110
114
 
111
115
    def run(self):
112
116
        cmd = "python tests/clitest.py"
116
120
            cmd += " prompt"
117
121
        if self.app:
118
122
            cmd += " --app %s" % self.app
 
123
        if self.category:
 
124
            cmd += " --category %s" % self.category
119
125
        os.system(cmd)
120
126
 
121
127
class TestURLFetch(TestBaseCommand):
146
152
 
147
153
    def run(self):
148
154
        import tests
149
 
        self._testfiles = [ "tests.urltest" ]
 
155
        self._testfiles = ["tests.urltest"]
150
156
        tests.urltest.MATCH_FILTER = self.match
151
157
        if self.path:
152
158
            for p in self.path:
199
205
    def run(self):
200
206
 
201
207
        # Generate POT file
202
 
        files = [ "virtinst/*.py", "virtconv/*.py", "virtconv/parsers/*.py",
203
 
                  "virt-*" ]
 
208
        files = ["virtinst/*.py", "virtconv/*.py", "virtconv/parsers/*.py",
 
209
                  "virt-*"]
204
210
        pot_cmd = "xgettext --language=Python -o po/virtinst.pot"
205
211
        for f in files:
206
212
            pot_cmd += " %s " % f
273
279
 
274
280
        for filename in glob(pjoin(os.getcwd(), 'po', '*.po')):
275
281
            filename = os.path.basename(filename)
276
 
            lang = os.path.basename(filename)[0:len(filename)-3]
 
282
            lang = os.path.basename(filename)[0:len(filename) - 3]
277
283
            if not os.path.exists("build/po/%s" % lang):
278
284
                os.makedirs("build/po/%s" % lang)
279
285
            newname = "build/po/%s/virtinst.mo" % lang
299
305
 
300
306
    def run(self):
301
307
        for initfile in [ "virtinst/__init__.py", "virtconv/__init__.py" ]:
302
 
            cmd =  "cat %s | " % initfile
 
308
            cmd  = "cat %s | " % initfile
303
309
            cmd += """sed -e "s,::LOCALEDIR::,%s," > """ % locale
304
310
            cmd += "%s/%s" % (builddir, initfile)
305
311
            os.system(cmd)
333
339
      license='GPL',
334
340
      url='http://virt-manager.et.redhat.com',
335
341
      package_dir={'virtinst': 'virtinst'},
336
 
      scripts = ["virt-install","virt-clone", "virt-image", "virt-convert"],
 
342
      scripts=["virt-install", "virt-clone", "virt-image", "virt-convert"],
337
343
      packages=pkgs,
338
 
      data_files = datafiles,
339
 
      cmdclass = { 'test': TestCommand, 'test_urls' : TestURLFetch,
340
 
                   'test_cli' : TestCLI,
341
 
                    'check': CheckPylint,
342
 
                    'rpm' : custom_rpm,
343
 
                    'sdist': sdist, 'build': build,
344
 
                    'install_data' : install_data,
345
 
                    'install_lib' : install_lib,
346
 
                    'install' : install,
347
 
                    'refresh_translations' : refresh_translations}
 
344
      data_files=datafiles,
 
345
      cmdclass={ 'test': TestCommand, 'test_urls' : TestURLFetch,
 
346
                 'test_cli' : TestCLI,
 
347
                 'check': CheckPylint,
 
348
                 'rpm' : custom_rpm,
 
349
                 'sdist': sdist, 'build': build,
 
350
                 'install_data' : install_data,
 
351
                 'install_lib' : install_lib,
 
352
                 'install' : install,
 
353
                 'refresh_translations' : refresh_translations}
348
354
      )