Skip to content

Commit

Permalink
Merge pull request #1 from cwiede/master
Browse files Browse the repository at this point in the history
initial version
  • Loading branch information
cwiede authored Mar 26, 2020
2 parents b155b92 + 136f196 commit 94e85dc
Show file tree
Hide file tree
Showing 303 changed files with 21,567 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ __pycache__/

# C extensions
*.so
*.dll
binary/

# installed include files
include/

# scons
.sconsign.dblite
workspace/build

# files generated during tests
nexxT/tests/core/test1.saved.json
nexxT/tests/core/test_except_constr_tmp.json
*.guistate


# Distribution / packaging
.Python
Expand Down
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nexxT
Copyright (C) 2020 ifm electronic gmbh
57 changes: 57 additions & 0 deletions nexxT/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020 ifm electronic gmbh
#
# THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
#

"""
Setup the logging here until we have a better place.
"""

def setup():
import logging
from pathlib import Path
import os
import sys
import platform

logger = logging.getLogger()
INTERNAL = 5 # setup log level for internal messages
logging.addLevelName(INTERNAL, "INTERNAL")
def internal(self, message, *args, **kws):
if self.isEnabledFor(INTERNAL):
# Yes, logger takes its '*args' as 'args'.
self._log(INTERNAL, message, args, **kws)
logging.Logger.internal = internal

console = logging.StreamHandler()
console.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(name)s: %(message)s"))
logger.addHandler(console)
logger.info("configured logger")
logger.setLevel(logging.INFO)

global useCImpl
useCImpl = not bool(int(os.environ.get("NEXXT_DISABLE_CIMPL", "0")))
if useCImpl:
# make sure to import PySide2 before loading the cnexxT extension module because
# there is a link-time dependency which would be impossible to resolve otherwise
import PySide2.QtCore
p = os.environ.get("NEXXT_CEXT_PATH", None)
if p is None:
variant = os.environ.get("NEXXT_VARIANT", "release")
cplatform = "linux_x86_64" if platform.system() == "Linux" else "msvc_x86_64"
p = [p for p in [Path(__file__).parent / "binary" / cplatform / variant,
Path(__file__).parent / "binary" / cplatform / variant] if p.exists()]
if len(p) > 0:
p = p[0].absolute()
else:
p = None
if p is not None:
p = str(Path(p).absolute())
logger.info("c extension module search path: %s", p)
sys.path.append(p)
import cnexxT as imp_cnexxT
global cnexxT
cnexxT = imp_cnexxT

setup()
Loading

0 comments on commit 94e85dc

Please sign in to comment.