Merge lp:~javier.collado/mago/minimal-testsuite-setup into lp:~mago-contributors/mago/mago-testsuite

Proposed by Javier Collado
Status: Merged
Merged at revision: 17
Proposed branch: lp:~javier.collado/mago/minimal-testsuite-setup
Merge into: lp:~mago-contributors/mago/mago-testsuite
Diff against target: 68 lines (+64/-0)
1 file modified
setup.py (+64/-0)
To merge this branch: bzr merge lp:~javier.collado/mago/minimal-testsuite-setup
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
Review via email: mp+50147@code.launchpad.net

Description of the change

Minimal setup file added to make it possible to install the test suite

To post a comment you must log in.
18. By Javier Collado

Print statement removed

19. By Javier Collado

Adding author_email

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks. Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'setup.py'
2--- setup.py 1970-01-01 00:00:00 +0000
3+++ setup.py 2011-02-17 15:51:31 +0000
4@@ -0,0 +1,64 @@
5+#!/usr/bin/python
6+import os, re, subprocess
7+from distutils.core import setup
8+
9+WHITELIST_PATTERNS = ('empathy', 'evince', 'gnome-terminal',
10+ 'jockey-gtk', 'language-selector',
11+ 'openoffice', 'sanitychecks', 'shotwell',
12+ 'time-admin', 'totem', 'transmission-gtk',
13+ 'unity', 'yelp')
14+BLACKLIST_PATTERNS = ()
15+
16+
17+def is_package_file(f):
18+ """
19+ Return True if it's a package file
20+ """
21+ if not os.path.isfile(f):
22+ return False
23+
24+ # File is excluded if no whitelist pattern matches
25+ if WHITELIST_PATTERNS:
26+ whitelist_patterns = [re.compile(pattern)
27+ for pattern in WHITELIST_PATTERNS]
28+ if not any(pattern.match(f) for pattern in whitelist_patterns):
29+ return False
30+
31+ # File is excluded if any whitelist pattern matches
32+ if BLACKLIST_PATTERNS:
33+ blacklist_patterns = [re.compile(pattern)
34+ for pattern in BLACKLIST_PATTERNS]
35+ if any(pattern.match(f) for pattern in blacklist_patterns):
36+ return False
37+ return True
38+
39+
40+def get_package_files():
41+ """
42+ Get the list of files to be included in the package
43+ """
44+ base_dir = os.getcwd()
45+ for dirpath, dirnames, filenames in os.walk(base_dir):
46+ rel_dir = os.path.relpath(dirpath, base_dir)
47+
48+ rel_filenames = [os.path.join(rel_dir, filename)
49+ for filename in filenames]
50+ package_filenames = [filename for filename in rel_filenames
51+ if is_package_file(filename)]
52+ if package_filenames:
53+ yield (os.path.join('share/mago-testsuite', rel_dir),
54+ package_filenames)
55+
56+
57+def main():
58+ setup(name = 'mago-testsuite',
59+ author = 'Mago Contributors',
60+ author_email = 'desktop-testing-list@gnome.org',
61+ url = 'https://launchpad.net/mago',
62+ license = 'GPLv3',
63+ description = 'Mago test suite',
64+ data_files = list(get_package_files()))
65+
66+
67+if __name__ == '__main__':
68+ main()

Subscribers

People subscribed via source and target branches