~ubuntu-branches/ubuntu/lucid/pytagsfs/lucid

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Y Giridhar Appaji Nag
  • Date: 2008-08-15 16:14:36 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815161436-pa39vl4sszsl7l1z
Tags: 0.7.1-2
We need fusermount hence depend on fuse-utils

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
from distutils.dir_util import remove_tree
14
14
from distutils.dist import Distribution
15
15
 
16
 
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'modules'))
 
16
project_dir = os.path.dirname(__file__)
 
17
modules_dir = os.path.join(project_dir, 'modules')
 
18
 
 
19
sys.path.insert(0, modules_dir)
 
20
sys.path.insert(0, project_dir)
 
21
 
 
22
from tests.common import TEST_DIR, TEST_DATA_DIR
 
23
 
 
24
################################################################################
 
25
 
 
26
class test(Command):
 
27
    description = 'run tests'
 
28
    user_options = [
 
29
      ('tests=', None, 'names of tests to run'),
 
30
      ('print-only', None, "don't run tests, just print their names"),
 
31
    ]
 
32
 
 
33
    def initialize_options(self):
 
34
        self.tests = None
 
35
        self.print_only = False
 
36
 
 
37
    def finalize_options(self):
 
38
        if self.tests is not None:
 
39
            self.tests = self.tests.split(',')
 
40
 
 
41
    def run(self):
 
42
        from tests import load, main, print_names
 
43
        load()
 
44
        if self.print_only:
 
45
            print_names(self.tests)
 
46
        else:
 
47
            main(self.tests)
17
48
 
18
49
################################################################################
19
50
 
48
79
            except (IOError, OSError):
49
80
                log.warn("failed to remove '%s'" % dirname)
50
81
 
 
82
    def clean_test_data(self):
 
83
        status, output = commands.getstatusoutput(
 
84
          'test -x $(which fusermount) && which fusermount')
 
85
        if status == 0:
 
86
            umount_cmd = '%s -u' % output.strip()
 
87
        else:
 
88
            status, output = commands.getstatusoutput(
 
89
              'test -x $(which umount) && which umount')
 
90
            if status == 0:
 
91
                umount_cmd = output.strip()
 
92
            else:
 
93
                raise AssertionError("can't find a umount command")
 
94
 
 
95
        test_tree_root = os.path.join(TEST_DIR, 'test-trees')
 
96
        try:
 
97
            dirs = os.listdir(test_tree_root)
 
98
        except (IOError, OSError):
 
99
            log.warn(
 
100
              "not cleaning '%s': failed to read directory" % test_tree_root)
 
101
        else:
 
102
            for dir in dirs:
 
103
                full_dir = os.path.join(test_tree_root, dir)
 
104
                mnt_dir = os.path.join(full_dir, 'mnt')
 
105
 
 
106
                log.info("unmounting '%s'" % mnt_dir)
 
107
                status, output = commands.getstatusoutput(
 
108
                  '%s %s' % (umount_cmd, mnt_dir))
 
109
                if status != 0:
 
110
                    print >>sys.stderr, output
 
111
 
 
112
                self.clean_dir(full_dir)
 
113
 
 
114
            os.rmdir(test_tree_root)
 
115
 
 
116
        self.clean_dir(TEST_DATA_DIR)
 
117
 
51
118
    def run(self):
 
119
        self.clean_test_data()
 
120
 
52
121
        remove_files = list(self.temporary_files)
53
122
        if self.all:
54
123
            remove_files = remove_files + self.nontemporary_files
195
264
 
196
265
setup(
197
266
  cmdclass = {
 
267
    'test': test,
198
268
    'build': build,
199
269
    'build_version_file': build_version_file,
200
270
    'build_manpages': build_manpages,
207
277
  },
208
278
  packages = [
209
279
    'pytagsfs',
 
280
    'pytagsfs.metastore',
210
281
    'pytagsfs.pathstore',
211
282
    'pytagsfs.sourcetreemon',
212
283
    'pytagsfs.sourcetreerep',
 
284
    'pytagsfs.specialfile',
213
285
  ],
214
286
  scripts = [
215
287
    'pytagsfs',