109
109
from abc import ABC , abstractmethod
110
110
from collections import OrderedDict
111
111
from subprocess import DEVNULL , PIPE
112
+ from typing import List , Optional , Tuple
112
113
113
114
import SCons .Debug
114
115
import SCons .Errors
117
118
118
119
# we use these a lot, so try to optimize them
119
120
from SCons .Debug import logInstanceCreation
120
- from SCons .Subst import SUBST_SIG , SUBST_RAW
121
+ from SCons .Subst import SUBST_CMD , SUBST_RAW , SUBST_SIG
121
122
from SCons .Util import is_String , is_List
122
123
123
124
class _null :
@@ -127,13 +128,10 @@ class _null:
127
128
execute_actions = True
128
129
print_actions_presub = False
129
130
130
- # Use pickle protocol 1 when pickling functions for signature
131
- # otherwise python3 and python2 will yield different pickles
132
- # for the same object.
133
- # This is due to default being 1 for python 2.7, and 3 for 3.x
134
- # TODO: We can roll this forward to 2 (if it has value), but not
135
- # before a deprecation cycle as the sconsigns will change
136
- ACTION_SIGNATURE_PICKLE_PROTOCOL = 1
131
+ # Use pickle protocol 4 when pickling functions for signature.
132
+ # This is the common format since Python 3.4
133
+ # TODO: use is commented out as not stable since 2017: e0bc3a04d5. Drop?
134
+ # ACTION_SIGNATURE_PICKLE_PROTOCOL = 4
137
135
138
136
139
137
def rfile (n ):
@@ -448,7 +446,7 @@ def _do_create_action(act, kw):
448
446
return act
449
447
450
448
if is_String (act ):
451
- var = SCons .Util .get_environment_var (act )
449
+ var = SCons .Util .get_environment_var (act )
452
450
if var :
453
451
# This looks like a string that is purely an Environment
454
452
# variable reference, like "$FOO" or "${FOO}". We do
@@ -1010,18 +1008,18 @@ def __str__(self) -> str:
1010
1008
return ' ' .join (map (str , self .cmd_list ))
1011
1009
return str (self .cmd_list )
1012
1010
1013
- def process (self , target , source , env , executor = None , overrides : bool = False ) :
1011
+ def process (self , target , source , env , executor = None , overrides : Optional [ dict ] = None ) -> Tuple [ List , bool , bool ] :
1014
1012
if executor :
1015
- result = env .subst_list (self .cmd_list , 0 , executor = executor , overrides = overrides )
1013
+ result = env .subst_list (self .cmd_list , SUBST_CMD , executor = executor , overrides = overrides )
1016
1014
else :
1017
- result = env .subst_list (self .cmd_list , 0 , target , source , overrides = overrides )
1018
- silent = None
1019
- ignore = None
1015
+ result = env .subst_list (self .cmd_list , SUBST_CMD , target , source , overrides = overrides )
1016
+ silent = False
1017
+ ignore = False
1020
1018
while True :
1021
1019
try : c = result [0 ][0 ][0 ]
1022
1020
except IndexError : c = None
1023
- if c == '@' : silent = 1
1024
- elif c == '-' : ignore = 1
1021
+ if c == '@' : silent = True
1022
+ elif c == '-' : ignore = True
1025
1023
else : break
1026
1024
result [0 ][0 ] = result [0 ][0 ][1 :]
1027
1025
try :
@@ -1031,7 +1029,7 @@ def process(self, target, source, env, executor=None, overrides: bool=False):
1031
1029
pass
1032
1030
return result , ignore , silent
1033
1031
1034
- def strfunction (self , target , source , env , executor = None , overrides : bool = False ) :
1032
+ def strfunction (self , target , source , env , executor = None , overrides : Optional [ dict ] = None ) -> str :
1035
1033
if self .cmdstr is None :
1036
1034
return None
1037
1035
if self .cmdstr is not _null :
0 commit comments