r5920 - allow commands that are .pyc files to be used

0 views
Skip to first unread message

s...@deluge-torrent.org

unread,
Nov 4, 2009, 6:49:07 PM11/4/09
to deluge...@googlegroups.com
Author: damoxc

Revision: 5920

Log:
allow commands that are .pyc files to be used

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog 2009-11-04 23:36:27 UTC (rev 5919)
+++ branches/1.2_RC/ChangeLog 2009-11-04 23:49:07 UTC (rev 5920)
@@ -11,6 +11,7 @@
* Escape hyphens in the manpage
* Make the delete key work
* Allow ~ to be used in the path in the add command
+ * Allow commands that are .pyc files to be used

=== Deluge 1.2.0_rc3 (01 November 2009) ===
==== Core ====

Modified: branches/1.2_RC/deluge/ui/console/main.py
===================================================================
--- branches/1.2_RC/deluge/ui/console/main.py 2009-11-04 23:36:27 UTC (rev 5919)
+++ branches/1.2_RC/deluge/ui/console/main.py 2009-11-04 23:49:07 UTC (rev 5920)
@@ -124,10 +124,12 @@
try:
commands = []
for filename in os.listdir(command_dir):
- if filename.split('.')[0] in exclude or filename.startswith('_') or not filename.endswith('.py'):
+ if filename.split('.')[0] in exclude or filename.startswith('_'):
continue
- cmd = get_command(filename[:-3])
- aliases = [ filename[:-3] ]
+ if not (filename.endswith('.py') or filename.endswith('.pyc')):
+ continue
+ cmd = get_command(filename.split('.')[len(filename.split('.')) - 2])
+ aliases = [ filename.split('.')[len(filename.split('.')) - 2] ]
aliases.extend(cmd.aliases)
for a in aliases:
commands.append((a, cmd))

Modified: trunk/deluge/ui/console/main.py
===================================================================
--- trunk/deluge/ui/console/main.py 2009-11-04 23:36:27 UTC (rev 5919)
+++ trunk/deluge/ui/console/main.py 2009-11-04 23:49:07 UTC (rev 5920)
@@ -124,10 +124,12 @@
try:
commands = []
for filename in os.listdir(command_dir):
- if filename.split('.')[0] in exclude or filename.startswith('_') or not filename.endswith('.py'):
+ if filename.split('.')[0] in exclude or filename.startswith('_'):
continue
- cmd = get_command(filename[:-3])
- aliases = [ filename[:-3] ]
+ if not (filename.endswith('.py') or filename.endswith('.pyc')):
+ continue
+ cmd = get_command(filename.split('.')[len(filename.split('.')) - 2])
+ aliases = [ filename.split('.')[len(filename.split('.')) - 2] ]
aliases.extend(cmd.aliases)
for a in aliases:
commands.append((a, cmd))


Reply all
Reply to author
Forward
0 new messages