Commits

Lenard Lindstrom committed 7bed880

pygame.examples: completely installs

  • Participants
  • Parent commits b165eee

Comments (0)

Files changed (4)

File examples/midi.py

 """
 
 import sys
+import os
 
 import pygame
 import pygame.midi
     images depending on the state of adjacent keys to its right.
 
     """
-    
-    strip_file = 'data/midikeys.png'
+
+    my_dir = os.path.split(os.path.abspath(__file__))[0]
+    strip_file = os.path.join(my_dir, 'data', 'midikeys.png')
     white_key_width = 42
     white_key_height = 160
     black_key_width = 22
         pygame_data_files.append(f)
 
 #examples
-data_files.append(('pygame/examples/data',
-                   glob.glob(os.path.join('examples', 'data', '*'))))
+def add_datafiles(data_files, pattern):
+    def do_directory(root_dest_path, root_src_path, subpattern):
+        subdir, elements = subpattern
+        files = []
+        dest_path = '/'.join([root_dest_path, subdir])
+        if root_src_path:
+            src_path = os.path.join(root_src_path, subdir)
+        else:
+            src_path = subdir
+        for e in elements:
+            if isinstance(e, list):
+                do_directory(dest_path, src_path, e)
+            else:
+                files.extend(glob.glob(os.path.join(src_path, e)))
+        data_files.append((dest_path, files))
+    do_directory('pygame', '', pattern)
+
+add_datafiles(data_files,
+              ['examples',
+                  ['*.py',
+                   'readme.txt',
+                   ['data',
+                       ['*']],
+                   ['macosx',
+                       ['*.py',
+                        ['aliens_app_example',
+                            ['*.py',
+                             'README.txt',
+                             ['English.lproj',
+                                 ['aliens.icns',
+                                  ['MainMenu.nib',
+                                      ['*']]]]]]]]]])
 
 # Required. This will be filled if doing a Windows build.
 cmdclass = {}
                        'pygame.gp2x': 'lib/gp2x',
                        'pygame.tests': 'test'},
        "package_data": {'pygame.tests': ['test_utils/*.py',
-                                         'fixtures/xbm_cursors/*.xbm']},
+                                         'fixtures/xbm_cursors/*.xbm',
+                                         'run_tests__tests/__init__.py',
+                                         'run_tests__tests/all_ok/*.py',
+                                         'run_tests__tests/failures1/*.py',
+                                         'run_tests__tests/incomplete/*.py',
+                                         'run_tests__tests/infinite_loop/*.py',
+                                         'run_tests__tests/print_stderr/*.py',
+                                         'run_tests__tests/print_stdout/*.py']},
        "headers":     headers,
        "ext_modules": extensions,
        "data_files":  data_files,

File test/run_tests__tests/all_ok/no_assertions(ret_code_of_1)_test.py

-if __name__ == '__main__':
-    import sys
-    import os
-    pkg_dir = (os.path.split(
-                   os.path.split(
-                       os.path.split(
-                           os.path.abspath(__file__))[0])[0])[0])
-    parent_dir, pkg_name = os.path.split(pkg_dir)
-    is_pygame_pkg = (pkg_name == 'tests' and
-                     os.path.split(parent_dir)[1] == 'pygame')
-    if not is_pygame_pkg:
-        sys.path.insert(0, parent_dir)
-else:
-    is_pygame_pkg = __name__.startswith('pygame.tests.')
-
-if is_pygame_pkg:
-    from pygame.tests import test_utils
-    from pygame.tests.test_utils import unittest
-else:
-    from test import test_utils
-    from test.test_utils import unittest
-
-class KeyModuleTest(unittest.TestCase):
-    def test_get_focused(self):
-        pass
-
-    def test_get_mods(self):
-        pass
-
-    def test_get_pressed(self):
-        pass
-
-    def test_name(self):
-        pass
-
-    def test_set_mods(self):
-        pass
-
-    def test_set_repeat(self):
-        pass
-
-if __name__ == '__main__':
-    unittest.main()

File test/run_tests__tests/all_ok/no_assertions__ret_code_of_1__test.py

+if __name__ == '__main__':
+    import sys
+    import os
+    pkg_dir = (os.path.split(
+                   os.path.split(
+                       os.path.split(
+                           os.path.abspath(__file__))[0])[0])[0])
+    parent_dir, pkg_name = os.path.split(pkg_dir)
+    is_pygame_pkg = (pkg_name == 'tests' and
+                     os.path.split(parent_dir)[1] == 'pygame')
+    if not is_pygame_pkg:
+        sys.path.insert(0, parent_dir)
+else:
+    is_pygame_pkg = __name__.startswith('pygame.tests.')
+
+if is_pygame_pkg:
+    from pygame.tests import test_utils
+    from pygame.tests.test_utils import unittest
+else:
+    from test import test_utils
+    from test.test_utils import unittest
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        pass
+
+    def test_get_mods(self):
+        pass
+
+    def test_get_pressed(self):
+        pass
+
+    def test_name(self):
+        pass
+
+    def test_set_mods(self):
+        pass
+
+    def test_set_repeat(self):
+        pass
+
+if __name__ == '__main__':
+    unittest.main()