Ignore:
Timestamp:
May 19, 2020, 8:59:28 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
24617e1
Parents:
d5199c9
Message:
  • Switched from CamelCase to camel_case naming
    • Added mapservice-webclient to configure script (Closes #33)
    • Switched from unittest to pytest tests
    • Fixed testing errors with post datas by introducing x-fail vendor extension
    • Added x-vendor extension to mark a dependency on mapservice for an operation and the controller_test.mustache adds needed fixtures
    • Copying conftest.py from *_impl/tests into */test (it's a workaround to get the flask app fixtures)
    • Fixed controller_test.mustache, to test the first response with set status code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • buildhelpers/configure

    rd5199c9 r9f0f35e  
    1111CURRENT_DIR = Path(os.path.dirname(__file__))
    1212SRC = CURRENT_DIR.joinpath('../src/gnuboat')
    13 SRC_GEN = CURRENT_DIR.joinpath('../src/gnuboat/')
     13SRC_GEN = CURRENT_DIR.joinpath('../src')
    1414APIS_DIR = CURRENT_DIR.joinpath('../apis')
    1515version_file = open(CURRENT_DIR.joinpath('../VERSION').resolve(), 'r')
    … …  
    5151    Package('mapservice', 'python-flask', CURRENT_DIR.joinpath('codegen/templates'), None),
    5252    Package('deviceservice', 'python-flask', CURRENT_DIR.joinpath('codegen/templates'), None),
    53     Package('mapservice', 'python', None, 'mapservice_client'),
     53    Package('mapservice', 'python', None, 'gnuboat/mapservice_client'),
     54    Package('mapservice', 'typescript-angular', None, 'mapservice-webclient/src-gen/gnuboat-mapservice'),
    5455]
    5556
    56 def generate_stub(package, generator, template_folder, target):
     57def generate_stub(package, generator, template_folder, target_dir):
    5758    target_tmp = SRC_GEN.joinpath('{}_tmp'.format(package))
    5859    service_specification_file = APIS_DIR.joinpath('{}.yaml'.format(package)).resolve()
    5960    server_port = 8080
    6061   
     62    target = target_dir.stem
    6163    package_name_gen = 'gnuboat.{}'.format(target)
    6264    target_tmp = SRC_GEN.joinpath('{}_tmp'.format(package))
    63     target_dir = SRC_GEN.joinpath(target)
     65    target_dir = SRC_GEN.joinpath(target_dir)
    6466    service_specification_file = APIS_DIR.joinpath('{}.yaml'.format(package)).resolve()
    6567    server_port = 8080
    … …  
    104106        return
    105107
    106     shutil.move(target_tmp.joinpath('gnuboat/{}'.format(target)).resolve(), target_dir.resolve())
    107     shutil.rmtree(target_tmp.resolve())
     108    if 'python' in generator:
     109        shutil.move(target_tmp.joinpath('gnuboat/{}'.format(target)).resolve(), target_dir.resolve())
     110        shutil.rmtree(target_tmp.resolve())
     111        # running yapf
     112        print('  Formatting the generated code accoring to style file')
     113        subprocess.run(['yapf', '--style', 'python-style.yapf', '-r', '-i',
     114            target_dir.resolve()])
     115        if 'python-flask' == generator:
     116            # copy conftest in place
     117            shutil.copy(target_dir.joinpath(
     118                '../{}_impl/tests/conftest.py'.format(package)).resolve(),
     119                target_dir.joinpath('test').resolve()
     120            )
     121    else:
     122        shutil.move(target_tmp, target_dir.resolve())
    108123
    109     # running yapf
    110     print('  Formatting the generated code accoring to style file')
    111     subprocess.run(['yapf', '--style', 'python-style.yapf', '-r', '-i',
    112         target_dir.resolve()])
    113124
    114125print('Generating the {} services:'.format(len(PACKAGES)))
    115126for package in PACKAGES:
    116127    print('  {}'.format(package.package))
    117 
    118128for package in PACKAGES:
    119129    package_name_gen = 'gnuboat.{}'.format(package)
    120130    if package.target is None:
    121         package.target = package.package
     131        package.target = Path('gnuboat').joinpath(package.package)
     132    else:
     133        package.target = Path(package.target)
    122134    generate_stub(package.package, package.generator, package.template_folder, package.target)
    123135   
Note: See TracChangeset for help on using the changeset viewer.