summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2020-02-05 13:10:35 +0100
committerGitHub <noreply@github.com>2020-02-05 13:10:35 +0100
commitdd40006b1cbf8f1f38af58f4997211b4b18c712f (patch)
tree939a72148d42a795dba029af167035e91092de21
parent1461a0c276978c0db1716f22a62f6d7d461f20ff (diff)
downloadqtivi-qface-upstream/1.10.1-patch.tar.gz
* Domain.py: fix qualified_name() (#73) * freeze qface dependencies based on QtIVI input (#92) * freeze qface dependencies based on QtIVI input * upgrade version number to 1.10.1 * updated requirements and cli file * fix cli test-ci naming * was wrong fix * fix travis ci script * upgrade to jinja 2.10.3 to fix jinja vulnerability of 2.10.0 Co-authored-by: jacky309 <jacques.guillou@gmail.com> Co-authored-by: Jürgen Ryannel <juergen.ryannel@icloud.com>
-rwxr-xr-xcli.py95
-rw-r--r--qface/__about__.py2
-rw-r--r--qface/idl/domain.py6
-rw-r--r--requirements.txt26
-rw-r--r--setup.py16
5 files changed, 28 insertions, 117 deletions
diff --git a/cli.py b/cli.py
index feab43a..ba31cc4 100755
--- a/cli.py
+++ b/cli.py
@@ -11,7 +11,6 @@ import os
import yaml
import logging
import logging.config
-from livereload import Server, shell
here = Path(__file__).abspath().dirname()
@@ -53,100 +52,6 @@ def test_ci():
sh('python3 -m pytest --cov=qface -v -l tests/')
-class RunTestChangeHandler(FileSystemEventHandler):
- def __init__(self, clickContext):
- super().__init__()
- self.clickContext = clickContext
-
- def on_any_event(self, event):
- if event.is_directory:
- return
- if Path(event.src_path).ext == '.py':
- sh('python3 -m pytest')
-
-
-@cli.command()
-@click.pass_context
-def test_monitor(ctx):
- """run the tests and re-run on changes"""
- sh('python3 -m pytest')
- while True:
- event_handler = RunTestChangeHandler(ctx)
- observer = Observer()
- observer.schedule(event_handler, './tests', recursive=True)
- observer.schedule(event_handler, './qface', recursive=True)
- observer.start()
- try:
- while True:
- time.sleep(1)
- except KeyboardInterrupt:
- observer.stop()
- observer.join()
-
-
-class RunScriptChangeHandler(FileSystemEventHandler):
- def __init__(self, script):
- super().__init__()
- self.script = script
- self.is_running = False
-
- def on_modified(self, event):
- if event.src_path.endswith('.cache'):
- return
- self.run()
-
- def run(self):
- if self.is_running:
- return
- self.is_running = True
- sh(self.script, cwd=Path.getcwd())
- self.is_running = False
-
-
-@cli.command()
-@click.argument('script', nargs=1, type=click.Path(exists=True))
-@click.argument('input', nargs=-1, type=click.Path(exists=True))
-@click.argument('output', nargs=1, type=click.Path(exists=True))
-def reload(script, input, output):
- """
- reloads the generator script when the script files
- or the input files changes
- """
- script = Path(script).expand().abspath()
- output = Path(output).expand().abspath()
- input = input if isinstance(input, (list, tuple)) else [input]
- output.makedirs_p()
- _script_reload(script, input, output)
-
-
-def _script_reload(script, input, output):
- """run the named generator and monitor the input and generator folder"""
- input = [Path(entry).expand().abspath() for entry in input]
- output = Path(output).expand().abspath()
- cmd = 'python3 {0} {1} {2}'.format(script, ' '.join(input), output)
- event_handler = RunScriptChangeHandler(cmd)
- event_handler.run() # run always once
- observer = Observer()
- path = script.dirname().expand().abspath()
- click.secho('watch: {0}'.format(path), fg='blue')
- observer.schedule(event_handler, path, recursive=True)
- for entry in input:
- entry = entry.dirname().expand().abspath()
- click.secho('watch: {0}'.format(entry), fg='blue')
- observer.schedule(event_handler, entry, recursive=True)
- path = Path(__file__).parent / 'qface'
- click.secho('watch: {0}'.format(path), fg='blue')
- observer.schedule(event_handler, path, recursive=True)
- observer.start()
-
- try:
- while True:
- time.sleep(1)
- except KeyboardInterrupt:
- observer.stop()
- observer.join()
-
-
@click.option('--editable/--no-editable', default=False, help='install editable package')
@cli.command()
def install(editable):
diff --git a/qface/__about__.py b/qface/__about__.py
index 2b8012d..254c35f 100644
--- a/qface/__about__.py
+++ b/qface/__about__.py
@@ -9,7 +9,7 @@ except NameError:
__title__ = "qface"
__summary__ = "A generator framework based on a common modern IDL"
__url__ = "https://pelagicore.github.io/qface/"
-__version__ = "1.10"
+__version__ = "1.10.1"
__author__ = "JRyannel"
__author_email__ = "qface-generator@googlegroups.com"
__copyright__ = "2018 Pelagicore"
diff --git a/qface/idl/domain.py b/qface/idl/domain.py
index 4c52b1a..ae2359b 100644
--- a/qface/idl/domain.py
+++ b/qface/idl/domain.py
@@ -106,7 +106,11 @@ class NamedElement(object):
if self.module == self:
return self.module.name
else:
- return '{0}.{1}'.format(self.module.name, self.name)
+ if "." not in self.name:
+ return '{0}.{1}'.format(self.module.name, self.name)
+ else:
+ # We have a fully qualified reference, just return it
+ return self.name
def toJson(self):
o = OrderedDict()
diff --git a/requirements.txt b/requirements.txt
index d3aa418..e8608f4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,13 +1,15 @@
antlr4-python3-runtime==4.7.1
-typing
-jinja2
-click
-path.py
-watchdog
-livereload
-pyyaml
-pytest
-coverage
-pytest-cov
-six
-coloredlogs
+argh==0.26.2
+click==6.7
+coloredlogs==10.0
+humanfriendly==4.15.1
+Jinja2==2.10.3
+MarkupSafe==1.0
+path.py==11.0.1
+pathtools==0.1.2
+PyYAML==5.1
+six==1.11.0
+typing==3.6.4
+watchdog==0.8.3
+pytest==5.3.5
+pytest-cov==2.8.1
diff --git a/setup.py b/setup.py
index 8792426..42a53c4 100644
--- a/setup.py
+++ b/setup.py
@@ -44,15 +44,15 @@ setup(
packages=find_packages(),
include_package_data=True,
install_requires=[
- 'click',
+ 'click==6.7',
'antlr4-python3-runtime==4.7.1',
- 'jinja2',
- 'path.py',
- 'pyyaml',
- 'typing',
- 'watchdog',
- 'six',
- 'coloredlogs',
+ 'jinja2==2.10.3',
+ 'path.py==11.0.1',
+ 'pyyaml==5.1',
+ 'typing==3.6.4',
+ 'watchdog==0.8.3',
+ 'six==1.11.0',
+ 'coloredlogs==10.0',
],
extras_require={
'dev': [