File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,29 @@ def _validate_thread_sharing(self):
54
54
55
55
56
56
class CeleryCommand (BaseCommand ):
57
- options = BaseCommand .option_list
57
+ options = ()
58
+ if hasattr (BaseCommand , 'option_list' ):
59
+ options = BaseCommand .option_list
60
+ else :
61
+ def add_arguments (self , parser ):
62
+ option_typemap = {
63
+ "string" : str ,
64
+ "int" : int ,
65
+ "float" : float
66
+ }
67
+ for opt in self .option_list :
68
+ option = {k : v
69
+ for k , v in opt .__dict__ .items ()
70
+ if v is not None }
71
+ flags = (option .get ("_long_opts" , []) +
72
+ option .get ("_short_opts" , []))
73
+ del option ["_long_opts" ]
74
+ del option ["_short_opts" ]
75
+ if "type" in option :
76
+ opttype = option ["type" ]
77
+ option ["type" ] = option_typemap .get (opttype , opttype )
78
+ parser .add_argument (* flags , ** option )
79
+
58
80
skip_opts = ['--app' , '--loader' , '--config' , '--no-color' ]
59
81
requires_system_checks = False
60
82
keep_base_opts = False
You can’t perform that action at this time.
0 commit comments