f4pga: rm sf_ prefixes

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-03-01 04:02:51 +01:00
parent fcb4ce8811
commit c44a0e164c
21 changed files with 72 additions and 61 deletions

View File

@ -28,18 +28,29 @@ from os import environ
import json
from typing import Iterable
from colorama import Fore, Style
from f4pga.sf_common import ResolutionEnv, fatal, scan_modules, set_verbosity_level, \
sfprint
from f4pga.sf_module import *
from f4pga.sf_cache import SymbiCache
import f4pga.sf_ugly as sf_ugly
from f4pga.sf_flow_config import ProjectFlowConfig, FlowConfig, FlowDefinition, \
open_project_flow_cfg, verify_platform_name, \
verify_stage
from f4pga.sf_module_runner import *
from f4pga.sf_module_inspector import get_module_info
from f4pga.sf_stage import Stage
from f4pga.sf_argparse import setup_argparser, get_cli_flow_config
from f4pga.common import (
ResolutionEnv,
fatal,
scan_modules,
set_verbosity_level,
sfprint
)
from f4pga.module import *
from f4pga.cache import SymbiCache
import f4pga.ugly as ugly
from f4pga.flow_config import (
ProjectFlowConfig,
FlowConfig,
FlowDefinition,
open_project_flow_cfg,
verify_platform_name,
verify_stage
)
from f4pga.module_runner import *
from f4pga.module_inspector import get_module_info
from f4pga.stage import Stage
from f4pga.argparser import setup_argparser, get_cli_flow_config
SYMBICACHEPATH = '.symbicache'
@ -462,7 +473,7 @@ def setup_resolution_env():
'shareDir': share_dir_path,
'binDir': os.path.realpath(os.path.join(share_dir_path, '../../bin'))
})
r_env.add_values(sf_ugly.generate_values())
r_env.add_values(ugly.generate_values())
return r_env
def open_project_flow_config(path: str) -> ProjectFlowConfig:

View File

@ -53,7 +53,7 @@ def setup_argparser():
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('-s', '--silent', action='store_true')
subparsers = parser.add_subparsers(dest='command')
build = subparsers.add_parser('build')
_setup_build_parser(build)
@ -74,13 +74,13 @@ def _parse_depval(depvalstr: str):
d = { 'name': None, 'stage': None, 'value': None }
splitted = list(_unescaped_separated('=', depvalstr))
if len(splitted) != 2:
raise Exception('Too many components')
pathstr = splitted[0]
valstr = splitted[1]
path_components = pathstr.split('.')
if len(path_components) < 1:
raise Exception('Missing value')
@ -89,9 +89,9 @@ def _parse_depval(depvalstr: str):
d['stage'] = path_components.pop(0)
if len(path_components) > 0:
raise Exception('Too many path components')
d['value'] = _parse_cli_value(valstr)
return d
def _unescaped_matches(regexp: str, s: str, escape_chr='\\'):
@ -99,7 +99,7 @@ def _unescaped_matches(regexp: str, s: str, escape_chr='\\'):
Find all occurences of a pattern in a string that contains escape sequences.
Yields pairs of starting and ending indices of the pattern.
"""
noescapes = ''
# We remove all escape sequnces from a string, so it will match only with
@ -117,7 +117,7 @@ def _unescaped_matches(regexp: str, s: str, escape_chr='\\'):
offsets.append(offset)
offset += 2
noescapes += noescape
iter = re.finditer(regexp, noescapes)
for m in iter:
@ -164,7 +164,7 @@ def _parse_cli_value(s: str):
if len(s) == 0:
return ''
# List
if s[0] == '[':
if len(s) < 2 or s[len(s)-1] != ']':
@ -191,15 +191,15 @@ def _parse_cli_value(s: str):
key = k_v[0]
value = _parse_cli_value(k_v[1])
d[key] = value
return d
# Bool hack
if s == '\\True':
return True
if s == '\\False':
return False
# Number hack
if len(s) >= 3 and s[0:1] == '\\N':
return int(s[2:])
@ -213,9 +213,9 @@ def get_cli_flow_config(args: Namespace, platform: str):
'dependencies': {},
'values': {},
}
platform_flow_config = create_defdict()
def add_entries(arglist: 'list[str]', dict_name: str):
for value_def in (_parse_depval(cliv) for cliv in arglist):
stage = value_def['stage']
@ -227,7 +227,7 @@ def get_cli_flow_config(args: Namespace, platform: str):
platform_flow_config[stage] = create_defdict()
platform_flow_config[stage][dict_name][value_def['name']] = \
value_def['value']
add_entries(args.dep, 'dependencies')
add_entries(args.val, 'values')

View File

@ -31,9 +31,9 @@ def scan_modules(mypath: str):
sfbuild_home = mypath
sfbuild_home_dirs = os.listdir(sfbuild_home)
sfbuild_module_dirs = \
[dir for dir in sfbuild_home_dirs if re.match('sf_.*_modules$', dir)]
[dir for dir in sfbuild_home_dirs if re.match('.*_modules$', dir)]
_sfbuild_module_collection_name_to_path = \
dict([(re.match('sf_(.*)_modules$', moddir).groups()[0],
dict([(re.match('(.*)_modules$', moddir).groups()[0],
os.path.join(sfbuild_home, moddir))
for moddir in sfbuild_module_dirs])

View File

@ -5,8 +5,8 @@
# ----------------------------------------------------------------------------- #
import os
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -49,8 +49,8 @@ import os
import shutil
import re
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -27,9 +27,9 @@ Accepted module parameters:
# ----------------------------------------------------------------------------- #
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.sf_module_runner import get_module
from f4pga.common import *
from f4pga.module import *
from f4pga.module_runner import get_module
# ----------------------------------------------------------------------------- #

View File

@ -12,8 +12,8 @@ lazily create the directories if they become necessary. """
# ----------------------------------------------------------------------------- #
import os
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -6,8 +6,8 @@
import os
import re
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -5,8 +5,8 @@
# ----------------------------------------------------------------------------- #
import os
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -5,8 +5,8 @@
# ----------------------------------------------------------------------------- #
import os
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -6,8 +6,8 @@
import os
import shutil
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -5,8 +5,8 @@
# ----------------------------------------------------------------------------- #
import os
from f4pga.sf_common import *
from f4pga.sf_module import *
from f4pga.common import *
from f4pga.module import *
# ----------------------------------------------------------------------------- #

View File

@ -1,8 +1,8 @@
import os
import json
from f4pga.sf_common import file_noext, ResolutionEnv, deep
from f4pga.sf_stage import Stage
from f4pga.common import file_noext, ResolutionEnv, deep
from f4pga.stage import Stage
from copy import copy
_realpath_deep = deep(os.path.realpath)

View File

@ -2,7 +2,7 @@
import abc
from types import SimpleNamespace
from f4pga.sf_common import *
from f4pga.common import *
from colorama import Fore, Style
class Module:

View File

@ -1,5 +1,5 @@
from f4pga.sf_module import Module
from f4pga.sf_common import decompose_depname
from f4pga.module import Module
from f4pga.common import decompose_depname
from colorama import Style
def _get_if_qualifier(deplist: 'list[str]', qualifier: str):

View File

@ -4,8 +4,8 @@ from contextlib import contextmanager
import importlib
import importlib.util
import os
from f4pga.sf_module import Module, ModuleContext, get_mod_metadata
from f4pga.sf_common import ResolutionEnv, deep, sfprint
from f4pga.module import Module, ModuleContext, get_mod_metadata
from f4pga.common import ResolutionEnv, deep, sfprint
from colorama import Fore, Style
_realpath_deep = deep(os.path.realpath)

View File

@ -78,7 +78,7 @@ setuptools_setup(
url="https://github.com/chipsalliance/f4pga",
packages=[
"f4pga",
"f4pga.sf_common_modules",
"f4pga.common_modules",
"f4pga.wrappers.sh",
],
package_dir={"f4pga": "."},

View File

@ -1,6 +1,6 @@
from f4pga.sf_common import decompose_depname, resolve_modstr
from f4pga.sf_module import Module
from f4pga.sf_module_runner import get_module, module_io
from f4pga.common import decompose_depname, resolve_modstr
from f4pga.module import Module
from f4pga.module_runner import get_module, module_io
class StageIO:
"""

View File

@ -1,7 +1,7 @@
""" The "ugly" module is dedicated for some *ugly* workarounds """
import os
from f4pga.sf_common import sub as common_sub
from f4pga.common import sub as common_sub
def noisy_warnings():
""" Emit some noisy warnings """