Changeset 24
- Timestamp:
- 05/29/06 13:34:41 (7 years ago)
- Files:
-
- branches/mk/cheesecake/cheesecake_index.py (modified) (6 diffs)
- branches/mk/tests/test_count_files.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/cheesecake/cheesecake_index.py
r23 r24 208 208 self.INDEX_REQUIRED_FILES = 100 209 209 self.INDEX_FILE_PYC = -20 210 self.INDEX_FILE_PYO = -20 210 211 self.INDEX_DIR_CRITICAL = 25 211 212 self.INDEX_DIR = 20 … … 233 234 "INDEX_INSTALL", "INDEX_FILE_CRITICAL", "INDEX_FILE", 234 235 "INDEX_REQUIRED_FILES", "INDEX_FILE_PYC", 236 "INDEX_FILE_PYO", 235 237 "INDEX_DIR_CRITICAL", "INDEX_DIR", "INDEX_DIR_EMPTY", 236 238 "MAX_INDEX_DOCSTRINGS", "MAX_INDEX_PYLINT", … … 362 364 self.pkg_files = {} 363 365 self.pkg_dirs = {} 364 self.file_types = ["py", "pyc", "test", 365 ] 366 self.file_types = ["py", "pyc", "pyo", "test"] 366 367 for type in self.file_types: 367 368 self.pkg_files[type] = [] … … 659 660 self.pkg_files["pyc"].append(fullpath) 660 661 self.log.debug("pyc file found: " + fullpath) 662 elif self.is_pyo_file(file, dirs_in_rootdir): 663 self.pkg_files["pyo"].append(fullpath) 664 self.log.debug("pyo file found: " + fullpath) 661 665 662 666 len_pyc_list = len(self.pkg_files["pyc"]) … … 664 668 self.index["file"].set_index("pyc", value=self.INDEX_FILE_PYC, 665 669 details="%d .pyc files found" % len_pyc_list) 670 671 len_pyo_list = len(self.pkg_files["pyo"]) 672 if len_pyo_list: 673 self.index["file"].set_index("pyo", value=self.INDEX_FILE_PYO, 674 details="%d .pyo files found" % len_pyo_list) 675 666 676 self.log.debug("Found %d py files" % len(self.pkg_files["py"])) 667 self.log.debug("Found %d pyc files" % len(self.pkg_files["pyc"])) 677 self.log.debug("Found %d pyc files" % len_pyc_list) 678 self.log.debug("Found %d pyo files" % len_pyo_list) 668 679 self.log.debug("Found %d test files" % len(self.pkg_files["test"])) 669 680 … … 671 682 672 683 def is_pyc_file(self, filename, dirs): 673 return has_extension(file, ".pyc") 674 675 def is_py_file(self, file, dirs): 684 return has_extension(filename, ".pyc") 685 686 def is_pyo_file(self, filename, dirs): 687 return has_extension(filename, ".pyo") 688 689 def is_py_file(self, filename, dirs): 676 690 """ 677 691 Return True if file ends with .py and it is not a special file and it is not 678 692 in special directory 679 693 """ 680 if not has_extension(file , ".py"):694 if not has_extension(filename, ".py"): 681 695 return False 682 696 if file in ["setup.py", "ez_setup.py", "__init__.py", "__pkginfo__.py"]: branches/mk/tests/test_count_files.py
r23 r24 8 8 import _path_cheesecake 9 9 from cheesecake.cheesecake_index import Cheesecake 10 11 if 'set' not in dir(__builtins__): 12 from sets import Set as set 10 13 11 14 … … 54 57 self.cheesecake.walk_pkg() 55 58 56 assert se lf.cheesecake.pkg_files['py'] == py_files59 assert set(self.cheesecake.pkg_files['py']) == set(py_files) 57 60 assert self.cheesecake.pkg_files['pyc'] == [] 61 assert self.cheesecake.pkg_files['pyo'] == [] 58 62 assert self.cheesecake.pkg_files['test'] == [] 59 63 64 65 class TestPycPyoFiles(CountFiles): 66 def test_some_pyc_and_pyo_files(self): 67 py_files = self.prefix_with_package_name(['main.py']) 68 pyc_files = self.prefix_with_package_name(['main.pyc', 'missing.pyc']) 69 pyo_files = self.prefix_with_package_name(['main.pyo', 'optimised.pyo']) 70 71 self.create_files(py_files + pyc_files + pyo_files) 72 self.cheesecake.walk_pkg() 73 74 assert set(self.cheesecake.pkg_files['py']) == set(py_files) 75 assert set(self.cheesecake.pkg_files['pyc']) == set(pyc_files) 76 assert set(self.cheesecake.pkg_files['pyo']) == set(pyo_files) 77 assert self.cheesecake.pkg_files['test'] == []
