(self, arg_name, req_features)
| 1893 | |
| 1894 | _parse_regex_arg = re.compile(r'\s|,|([+-])') |
| 1895 | def _parse_arg_features(self, arg_name, req_features): |
| 1896 | if not isinstance(req_features, str): |
| 1897 | self.dist_fatal("expected a string in '%s'" % arg_name) |
| 1898 | |
| 1899 | final_features = set() |
| 1900 | # space and comma can be used as a separator |
| 1901 | tokens = list(filter(None, re.split(self._parse_regex_arg, req_features))) |
| 1902 | append = True # append is the default |
| 1903 | for tok in tokens: |
| 1904 | if tok[0] in ("#", "$"): |
| 1905 | self.dist_fatal( |
| 1906 | arg_name, "target groups and policies " |
| 1907 | "aren't allowed from arguments, " |
| 1908 | "only from dispatch-able sources" |
| 1909 | ) |
| 1910 | if tok == '+': |
| 1911 | append = True |
| 1912 | continue |
| 1913 | if tok == '-': |
| 1914 | append = False |
| 1915 | continue |
| 1916 | |
| 1917 | TOK = tok.upper() # we use upper-case internally |
| 1918 | features_to = set() |
| 1919 | if TOK == "NONE": |
| 1920 | pass |
| 1921 | elif TOK == "NATIVE": |
| 1922 | native = self.cc_flags["native"] |
| 1923 | if not native: |
| 1924 | self.dist_fatal(arg_name, |
| 1925 | "native option isn't supported by the compiler" |
| 1926 | ) |
| 1927 | features_to = self.feature_names( |
| 1928 | force_flags=native, macros=[("DETECT_FEATURES", 1)] |
| 1929 | ) |
| 1930 | elif TOK == "MAX": |
| 1931 | features_to = self.feature_supported.keys() |
| 1932 | elif TOK == "MIN": |
| 1933 | features_to = self.feature_min |
| 1934 | else: |
| 1935 | if TOK in self.feature_supported: |
| 1936 | features_to.add(TOK) |
| 1937 | else: |
| 1938 | if not self.feature_is_exist(TOK): |
| 1939 | self.dist_fatal(arg_name, |
| 1940 | ", '%s' isn't a known feature or option" % tok |
| 1941 | ) |
| 1942 | if append: |
| 1943 | final_features = final_features.union(features_to) |
| 1944 | else: |
| 1945 | final_features = final_features.difference(features_to) |
| 1946 | |
| 1947 | append = True # back to default |
| 1948 | |
| 1949 | return final_features |
| 1950 | |
| 1951 | _parse_regex_target = re.compile(r'\s|[*,/]|([()])') |
| 1952 | def _parse_target_tokens(self, tokens): |
no test coverage detected