Code

Ticket #12846: bytecode_loader.diff

File bytecode_loader.diff, 739 bytes (added by echos, 2 years ago)
Line 
1diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
2index 8e83304..0bd8446 100644
3--- a/django/core/management/__init__.py
4+++ b/django/core/management/__init__.py
5@@ -1,4 +1,5 @@
6 import collections
7+import fnmatch
8 import os
9 import sys
10 from optparse import OptionParser, NO_DEFAULT
11@@ -25,8 +26,8 @@ def find_commands(management_dir):
12     """
13     command_dir = os.path.join(management_dir, 'commands')
14     try:
15-        return [f[:-3] for f in os.listdir(command_dir)
16-                if not f.startswith('_') and f.endswith('.py')]
17+        return [os.path.splitext(f)[0] for f in fnmatch.filter(
18+                os.listdir(command_dir), '[!_]*.py[co]')]
19     except OSError:
20         return []
21