diff --git a/.gitignore b/.gitignore index 72364f9..2e05ce6 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,6 @@ ENV/ # Rope project settings .ropeproject + +# JetBrain +.idea \ No newline at end of file diff --git a/PyPLC/PyPLC.py b/PyPLC/PyPLC.py index 782e653..b994e06 100644 --- a/PyPLC/PyPLC.py +++ b/PyPLC/PyPLC.py @@ -1785,7 +1785,7 @@ def __init__(self, name): # PyPLC class main method # #================================================================== -if __name__ == '__main__': +def main(): try: py = ('PyUtil' in dir(PyTango) and PyTango.PyUtil or PyTango.Util)(sys.argv) from fandango.interface import FullTangoInheritance @@ -1811,7 +1811,11 @@ def __init__(self, name): except Exception,e: print '__main__ -------> An unforeseen exception occured....',e traceback.print_exc() - + + +if __name__ == '__main__': + main() + else: from fandango.interface import FullTangoInheritance PyPLC,PyPLCClass = FullTangoInheritance('PyPLC',PyPLC,PyPLCClass,DynamicDS,DynamicDSClass,Exclude=['Lock','Unlock','isLocked'],ForceDevImpl=True) diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml new file mode 100644 index 0000000..b5d49c7 --- /dev/null +++ b/conda/conda_build_config.yaml @@ -0,0 +1,6 @@ +python: + - 2.7 + +numpy: + - 1.11 + diff --git a/conda/meta.yaml b/conda/meta.yaml new file mode 100644 index 0000000..9d76c78 --- /dev/null +++ b/conda/meta.yaml @@ -0,0 +1,49 @@ +{% set data = load_setup_py_data(setup_file="../setup.py", + from_recipe_dir=True) %} + +{% set GIT_HASHTAG = os.popen("git log --pretty=format:'%h' -n 1" ) + .read().strip()%} + +package: + name: {{ data.get('name') }} + version: {{ data.get('version') }} + +source: + path: .. + +build: + number: {{environ.get('BUILD_NUMBER',0)}} + noarch: python + script: '{{PYTHON}} setup.py install --single-version-externally-managed + --record=record.txt' + + string: 'py{{CONDA_PY}}_{{ PKG_BUILDNUM }}_g{{GIT_HASHTAG}}' + entry_points: {{data.get('entry_points', {}).get('console_scripts', [])}} + +requirements: + host: + - python {{python}} + - setuptools + run: + - python {{python}} + - fandango + - pytango + +test: + requires: + - fandango + - pytango + imports: + {% for pack in data['packages'] %} + - {{pack}} + {% endfor %} + +about: + home: {{ data.get('url')}} + license: {{ data.get('license')}} + summary: {{ data.get('description')}} + author: {{ data.get('author')}} + description: {{ data.get('long_description')}} + + + diff --git a/setup.py b/setup.py index 17bed95..3e4e8f1 100644 --- a/setup.py +++ b/setup.py @@ -23,10 +23,9 @@ ------------------------------------------------------------------------------- """ -print(__doc__) +# print(__doc__) version = str(open('PyPLC/VERSION').read().strip()) -scripts = ['bin/PyPLC'] license = 'GPL-3.0' package_dir = {'PyPLC': 'PyPLC',} @@ -41,7 +40,11 @@ description = 'Tango device for Modbus equipment', packages = packages, package_dir= package_dir, - scripts = scripts, + entry_points={ + 'console_scripts': [ + 'PyPLC = PyPLC.PyPLC:main' + ] + }, include_package_data = True, package_data = package_data, install_requires=['fandango>=14.6.0','PyTango'],