diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index c61ab2b..aa02828 100644
|
a
|
b
|
def find_commands(management_dir):
|
| 25 | 25 | |
| 26 | 26 | Returns an empty list if no commands are defined. |
| 27 | 27 | """ |
| | 28 | import re |
| | 29 | |
| 28 | 30 | command_dir = os.path.join(management_dir, 'commands') |
| | 31 | command_set = set() |
| 29 | 32 | try: |
| 30 | | return [f[:-3] for f in os.listdir(command_dir) |
| 31 | | if not f.startswith('_') and f.endswith('.py')] |
| | 33 | for f in os.listdir(command_dir): |
| | 34 | if re.match(r'^[^_].*\.py[co]?$', f): |
| | 35 | command_set.add(os.path.splitext(f)[0]) |
| | 36 | return list(command_set) |
| 32 | 37 | except OSError: |
| 33 | 38 | return [] |
| 34 | 39 | |