mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2025-06-24 08:20:30 +00:00
Compare commits
7 Commits
feature-py
...
FIWARE_7.7
Author | SHA1 | Date | |
---|---|---|---|
1052fd4a08 | |||
c3ac4f9dfb | |||
7781b15c4e | |||
b9034a916f | |||
5257a11cf0 | |||
461698b32a | |||
734a51fb73 |
79
.travis.yml
79
.travis.yml
@ -1,36 +1,55 @@
|
||||
services:
|
||||
- docker
|
||||
- docker
|
||||
dist: xenial
|
||||
before_script:
|
||||
- sudo apt update
|
||||
- sudo apt install qemu-user-static
|
||||
- "./create-binary-docker backend"
|
||||
- "./create-binary-docker backend -a arm"
|
||||
- "./create-binary-docker gateway"
|
||||
- "./create-binary-docker gateway -a arm"
|
||||
- "./create-binary-docker orioncontextbroker"
|
||||
- "./create-binary-docker orioncontextbroker -a arm"
|
||||
- "./create-binary-docker influxdbapp"
|
||||
- "./create-binary-docker influxdbapp -a arm"
|
||||
- "./create-binary-docker cul868ipe"
|
||||
- "./create-binary-docker cul868ipe -a arm"
|
||||
- sudo apt update
|
||||
- sudo apt install qemu-user-static python3 python3-pip python3-setuptools
|
||||
- sudo pip3 install --upgrade pip
|
||||
- sudo python3 -m pip install --upgrade setuptools
|
||||
- sudo python3 -m pip install --upgrade pyresttest
|
||||
- "./create-binary-docker backend"
|
||||
- "./create-binary-docker backend -a arm"
|
||||
- "./create-binary-docker gateway"
|
||||
- "./create-binary-docker gateway -a arm"
|
||||
- "./create-binary-docker orioncontextbroker"
|
||||
- "./create-binary-docker orioncontextbroker -a arm"
|
||||
- "./create-binary-docker influxdbapp"
|
||||
- "./create-binary-docker influxdbapp -a arm"
|
||||
- "./create-binary-docker cul868ipe"
|
||||
- "./create-binary-docker cul868ipe -a arm"
|
||||
- docker run -d --name backend -p 0.0.0.0:18000:18000 -e "ONEM2M_CSE_ID=backend" -e "ONEM2M_NOTIFICATION_DISABLED=false" openmtc/backend-amd64 -v
|
||||
- docker logs backend
|
||||
- docker run -d --name gateway -p 0.0.0.0:8000:8000 -e "ONEM2M_HTTP_TRANSPORT_PORT=8000" -e "ONEM2M_CSE_ID=gateway" -e "ONEM2M_REMOTE_CSE_POA=<POA>" -e "ONEM2M_REMOTE_CSE_ID=backend" -e "ONEM2M_NOTIFICATION_DISABLED=false" -e "ONEM2M_REGISTRATION_DISABLED=false" openmtc/gateway-amd64 -v
|
||||
- docker logs gateway
|
||||
script:
|
||||
- docker tag openmtc/orioncontextbroker-amd64 openmtc/orion-context-broker-app-amd64
|
||||
- docker tag openmtc/orioncontextbroker-arm openmtc/orion-context-broker-app-arm
|
||||
- docker tag openmtc/cul868ipe-amd64 openmtc/cul868-ipe-amd64
|
||||
- docker tag openmtc/cul868ipe-arm openmtc/cul868-ipe-arm
|
||||
- docker tag openmtc/influxdbapp-amd64 openmtc/influxdb-app-amd64
|
||||
- docker tag openmtc/influxdbapp-arm openmtc/influxdb-app-arm
|
||||
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
|
||||
- docker push openmtc/backend-amd64
|
||||
- docker push openmtc/backend-arm
|
||||
- docker push openmtc/gateway-amd64
|
||||
- docker push openmtc/gateway-arm
|
||||
- docker push openmtc/orion-context-broker-app-amd64
|
||||
- docker push openmtc/orion-context-broker-app-arm
|
||||
- docker push openmtc/cul868-ipe-amd64
|
||||
- docker push openmtc/cul868-ipe-arm
|
||||
- docker push openmtc/influxdb-app-amd64
|
||||
- docker push openmtc/influxdb-app-arm
|
||||
- docker tag openmtc/orioncontextbroker-amd64 openmtc/orion-context-broker-app-amd64
|
||||
- docker tag openmtc/orioncontextbroker-arm openmtc/orion-context-broker-app-arm
|
||||
- docker tag openmtc/cul868ipe-amd64 openmtc/cul868-ipe-amd64
|
||||
- docker tag openmtc/cul868ipe-arm openmtc/cul868-ipe-arm
|
||||
- docker tag openmtc/influxdbapp-amd64 openmtc/influxdb-app-amd64
|
||||
- docker tag openmtc/influxdbapp-arm openmtc/influxdb-app-arm
|
||||
- docker logs gateway
|
||||
- docker logs backend
|
||||
after_script:
|
||||
- pyresttest http://localhost:8000 tests/interoperability/basic.yaml
|
||||
env:
|
||||
matrix:
|
||||
secure: oQe/MxxFrPPArxb6OFzOUwG2ZlA5GYekMR6qn0Y3101v82MdrIVgDILHR41iwykTtk1XpJPV9uabsRsvY4hBmbjYzihYZFOAzFf+/KU7wROtKum0fFfLjCPb8uGV41k1JTquB94FibXboVAP7rNL0Vrpl+FGUvMGatQBtwZnGvha6Ha07qTao+X9+0dJ4YvFlvcba/jfzBZBwHw7KHpRoiyKU0dPmXpHcqnZBFcNqRXhzdVrgx0auP/tghoshW5LQWkpTV11uSx/kYuby4oo8r8nB6L0rW1jYSXs9DHiTQCfCy24xlb9YJjCD9aFcjH0lIkVIqQwJYA67MzKYMK4XV684J/Jr3+jfVOoUt0bpZaTnk+r/uiFCtEsN7q0KUlvHLUAi1YNJhKs6CRrAH3GK25QByh+suzPzZoHP42F2LYP9URlzbDH+/v7CwNuw+9pHSmxEhs18LVmggwkMos3o3ArvzMLRNJ3QG1fdoxL/Ubqxhmvhy4rZi6vGQsiF64oX8PN0sRgXekTU/ma+6CTM6qhgkocMUYzT2r/6qd/9R3jmtxSZnikjkR6Iu9NLzAUY+cqnvvjohAvqYyj+tGlQfOPxAU9H4wXnbQWLBM8yn6yt2Ki+3+Jx4Owdv0oXVJpN0GWjMzIJ1nEus5odkWW+c4wcZb6m3Ak0PrzYPp2BgE=
|
||||
after_success:
|
||||
- if [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
|
||||
docker push openmtc/backend-amd64;
|
||||
docker push openmtc/backend-arm;
|
||||
docker push openmtc/gateway-amd64;
|
||||
docker push openmtc/gateway-arm;
|
||||
docker push openmtc/orion-context-broker-app-amd64;
|
||||
docker push openmtc/orion-context-broker-app-arm;
|
||||
docker push openmtc/cul868-ipe-amd64;
|
||||
docker push openmtc/cul868-ipe-arm;
|
||||
docker push openmtc/influxdb-app-amd64;
|
||||
docker push openmtc/influxdb-app-arm;
|
||||
fi
|
||||
after_failure:
|
||||
- docker logs backend
|
||||
- docker logs gateway
|
||||
- coveralls
|
6
CONTRIBUTIONS.md
Normal file
6
CONTRIBUTIONS.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Contributors ordered by number of commits
|
||||
|
||||
Ronald Steinke <rst-fokus>
|
||||
Christian Klopp <ckl-fokus>
|
||||
Alexander Ortlieb <aor-fokus>
|
||||
Jason Fox <jason-fox>
|
15
README.md
15
README.md
@ -12,6 +12,8 @@
|
||||

|
||||
[](https://hub.docker.com/u/openmtc)
|
||||
[](https://travis-ci.org/OpenMTC/OpenMTC)
|
||||
[](https://snyk.io/test/github/OpenMTC/OpenMTC?targetFile=openmtc-gevent%2Frequirements.txt)
|
||||
[](https://coveralls.io/github/OpenMTC/OpenMTC?branch=master)
|
||||
|
||||
The OpenMTC SDK aims to provide developers with a convenient yet flexible tool
|
||||
to write oneM2M compliant applications. This includes network applications
|
||||
@ -22,16 +24,19 @@ This project is part of [FIWARE](https://www.fiware.org/). For more information
|
||||
check the FIWARE Catalogue entry for the
|
||||
[IoT Agents](https://github.com/Fiware/catalogue/tree/master/iot-agents).
|
||||
|
||||
| :books: [Documentation](https://fiware-openmtc.readthedocs.io) | :page_facing_up: [Site](http://www.openmtc.org) | :whale: [Docker Hub](https://hub.docker.com/u/openmtc) | :dart: [Roadmap](roadmap.md) |
|
||||
|
||||
# Content
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
- [Quality Assurance](#quality-assurance)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
|
||||
## Install
|
||||
## Install
|
||||
|
||||
Information about how to install the JSON IoTAgent can be found at the
|
||||
corresponding section of the
|
||||
@ -89,10 +94,14 @@ follows:
|
||||
|
||||
---
|
||||
|
||||
## Licence
|
||||
## Contributing
|
||||
|
||||
Contribution guidelines are detailed in the [CONTRIBUTIONS](CONTRIBUTIONS.md) file.
|
||||
|
||||
## License
|
||||
|
||||
The OpenMTC SDK is licensed under the Eclipse Public License (EPL)
|
||||
version 1.
|
||||
|
||||
© 2018 OpenMTC
|
||||
© 2018-2019 OpenMTC
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
Transfer OpenMTC Data to an InfluxDB
|
||||
"""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
__version__ = "1.3.0"
|
||||
__description__ = "InfluxdbApp"
|
||||
__author_name__ = "Christian Klopp"
|
||||
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"
|
||||
|
@ -3,7 +3,7 @@ This App will forward all incoming sensor traffic to the Fiware Orion Context
|
||||
Broker
|
||||
"""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
__version__ = "1.3.0"
|
||||
__description__ = "OrionContextBroker"
|
||||
__author_name__ = "Christian Klopp"
|
||||
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"
|
||||
|
@ -1,5 +1,6 @@
|
||||
from urllib.parse import urljoin
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
@ -89,7 +90,8 @@ class OrionAPI(LoggerMixin):
|
||||
"type": self._get_type(data_senml["v"]),
|
||||
"metadata": {
|
||||
"timestamp": {
|
||||
"value": data_senml["t"],
|
||||
"value": datetime.fromtimestamp(float(data_senml["t"])).replace(microsecond=0).isoformat()
|
||||
if data_senml["t"] != "none" else data_senml["t"],
|
||||
"type": "String"
|
||||
},
|
||||
"bn": {
|
||||
|
@ -2,7 +2,7 @@
|
||||
App to inject data from a csv file to OpenMTC
|
||||
"""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
__version__ = "1.3.0"
|
||||
__description__ = "csvInjector"
|
||||
__author_name__ = "Christian Klopp"
|
||||
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"
|
||||
|
@ -2,7 +2,7 @@
|
||||
TODO: Add description here
|
||||
"""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
__version__ = "1.3.0"
|
||||
__description__ = "mqttConnector"
|
||||
__author_name__ = "Ronald Steinke"
|
||||
__author_mail__ = "ronald.steinke@fokus.fraunhofer.de"
|
||||
|
@ -5,7 +5,7 @@ from enum import Enum
|
||||
from iso8601 import parse_date, ParseError
|
||||
from operator import attrgetter
|
||||
|
||||
from futile import basestring, issubclass, NOT_SET
|
||||
from futile import issubclass, NOT_SET
|
||||
from futile.logging import LoggerMixin
|
||||
from openmtc.model.exc import ModelError, ModelTypeError
|
||||
|
||||
|
@ -47,7 +47,7 @@ if [ ${#find_result[*]} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
if [ ${#find_result[*]} -gt 1 ]; then
|
||||
echo "Too many setup files matching the name. Exiting Now!."
|
||||
echo "Too many setup files matching the name. Exiting Now!. "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -68,7 +68,7 @@ get_target_from_setup_file ()
|
||||
local module_name=${setup_file%.py}
|
||||
|
||||
cd ${working_dir}
|
||||
python - << END_OF_PYTHON
|
||||
python3 - << END_OF_PYTHON
|
||||
from importlib import import_module
|
||||
setup = import_module('${module_name}', '${module_name}')
|
||||
print("%s-%s" % (setup.SETUP_NAME, setup.SETUP_VERSION))
|
||||
@ -92,7 +92,7 @@ rm -rf ${working_dir}/build
|
||||
|
||||
# build
|
||||
cd ${working_dir}
|
||||
python ${setup_file} bdist --plat-name docker >/dev/null 2>${log_file}
|
||||
python3 ${setup_file} bdist --plat-name docker >/dev/null 2>${log_file}
|
||||
|
||||
# clean up after
|
||||
rm -rf ${working_dir}/build
|
||||
@ -113,14 +113,14 @@ rm ${log_file}
|
||||
################################################################################
|
||||
# clean binary_package
|
||||
binary_archive="${working_dir}/dist/${binary_prefix}.docker.tar.gz"
|
||||
printf "### Stripping .py files..."
|
||||
#printf "### Stripping .py files..."
|
||||
cp ${target_file} ${binary_archive}
|
||||
gzip -d ${binary_archive}
|
||||
tar --wildcards --delete -f ${binary_archive%".gz"} "*.py"
|
||||
gzip ${binary_archive%".gz"}
|
||||
printf "done\n"
|
||||
#gzip -d ${binary_archive}
|
||||
#tar --wildcards --delete -f ${binary_archive%".gz"} "*.py"
|
||||
#gzip ${binary_archive%".gz"}
|
||||
#printf "done\n"
|
||||
rm ${target_file}
|
||||
printf "### Created binary archive at %s.\n" ${binary_archive}
|
||||
#printf "### Created binary archive at %s.\n" ${binary_archive}
|
||||
|
||||
################################################################################
|
||||
# set correct permissions
|
||||
|
@ -43,6 +43,6 @@ if __name__ == "__main__":
|
||||
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
|
||||
|
||||
ep = "http://localhost:8000"
|
||||
Runner(DataVisualization(), port=6050, host='auto').run(ep)
|
||||
Runner(DataVisualization(poas=['http://localhost:21345'])).run(ep)
|
||||
|
||||
|
||||
|
@ -91,4 +91,4 @@ if __name__ == "__main__":
|
||||
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
|
||||
|
||||
ep = "http://localhost:8000"
|
||||
Runner(DataAggregation(), port=6050, host='auto').run(ep)
|
||||
Runner(DataAggregation(poas=['http://localhost:21346'])).run(ep)
|
||||
|
@ -19,4 +19,4 @@ if __name__ == "__main__":
|
||||
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
|
||||
|
||||
ep = "http://localhost:8000"
|
||||
Runner(SimpleDecision2(), port=6050, host='auto').run(ep)
|
||||
Runner(SimpleDecision2(poas=['http://localhost:21387'])).run(ep)
|
||||
|
@ -47,4 +47,4 @@ if __name__ == "__main__":
|
||||
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
|
||||
|
||||
ep = "http://localhost:8000"
|
||||
Runner(SimpleDecision(), port=6050, host='auto').run(ep)
|
||||
Runner(SimpleDecision(poas=['http://localhost:22245'])).run(ep)
|
||||
|
@ -31,5 +31,6 @@ app_file=${app_array[$[${choice}-1]]}
|
||||
################################################################################
|
||||
# run app_file
|
||||
cd ${base_path}
|
||||
. ../../common/prep-env.sh
|
||||
python ${app_file}
|
||||
cd ..
|
||||
. ../common/prep-env.sh
|
||||
python3 ${app_file}
|
||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
||||
|
||||
# install openmtc dependencies
|
||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
||||
RUN pip install --upgrade --requirement /tmp/requirements.txt
|
||||
RUN pip3 install --upgrade --requirement /tmp/requirements.txt
|
||||
|
||||
# install openmtc-all
|
||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
||||
|
||||
# install openmtc dependencies
|
||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
||||
RUN pip install --upgrade --requirement /tmp/requirements.txt
|
||||
RUN pip3 install --upgrade --requirement /tmp/requirements.txt
|
||||
|
||||
# install openmtc-all
|
||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||
|
@ -3,7 +3,7 @@
|
||||
############################################################
|
||||
|
||||
# Set the base image to use debian
|
||||
FROM debian:jessie
|
||||
FROM debian:stretch
|
||||
|
||||
# Set the file maintainer
|
||||
MAINTAINER rst/tgu
|
||||
@ -20,8 +20,9 @@ RUN printf "Starting update...\n" && \
|
||||
build-essential \
|
||||
netbase \
|
||||
iproute2 \
|
||||
python-pip \
|
||||
python-dev \
|
||||
python3-setuptools \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
jq > /dev/null && \
|
||||
apt-get clean && \
|
||||
printf "Installation and cleanup finished.\n"
|
||||
|
@ -3,7 +3,7 @@
|
||||
############################################################
|
||||
|
||||
# Set the base image to use debian
|
||||
FROM resin/rpi-raspbian:jessie
|
||||
FROM resin/rpi-raspbian:stretch
|
||||
|
||||
# Set the file maintainer
|
||||
MAINTAINER rst/tgu
|
||||
@ -20,8 +20,9 @@ RUN printf "Starting update...\n" && \
|
||||
build-essential \
|
||||
netbase \
|
||||
iproute2 \
|
||||
python-pip \
|
||||
python-dev \
|
||||
python3-setuptools \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
jq > /dev/null && \
|
||||
apt-get clean && \
|
||||
printf "Installation and cleanup finished.\n"
|
||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
||||
|
||||
# install openmtc dependencies
|
||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
||||
RUN pip install --upgrade --requirement /tmp/requirements.txt
|
||||
RUN pip3 install --upgrade --requirement /tmp/requirements.txt
|
||||
|
||||
# install openmtc-all
|
||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
||||
|
||||
# install openmtc dependencies
|
||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
||||
RUN pip install --upgrade --requirement /tmp/requirements.txt
|
||||
RUN pip3 install --upgrade --requirement /tmp/requirements.txt
|
||||
|
||||
# install openmtc-all
|
||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||
|
@ -11,11 +11,11 @@ ENV MOD_NAME=sdk
|
||||
MAINTAINER rst/tgu
|
||||
|
||||
# update pip to latest version
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip3 install --upgrade pip
|
||||
|
||||
# install openmtc dependencies
|
||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
||||
RUN pip install --upgrade --requirement /tmp/requirements.txt
|
||||
RUN pip3 install --upgrade --requirement /tmp/requirements.txt
|
||||
|
||||
# install openmtc-sdk
|
||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||
|
@ -11,11 +11,11 @@ ENV MOD_NAME=sdk
|
||||
MAINTAINER rst/tgu
|
||||
|
||||
# update pip to latest version
|
||||
RUN pip install --upgrade pip setuptools
|
||||
RUN pip3 install --upgrade pip setuptools
|
||||
|
||||
# install openmtc dependencies
|
||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
||||
RUN pip install --upgrade --requirement /tmp/requirements.txt
|
||||
RUN pip3 install --upgrade --requirement /tmp/requirements.txt
|
||||
|
||||
# install openmtc-sdk
|
||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||
|
@ -103,7 +103,7 @@ if __name__ == '__main__':
|
||||
## end of http://code.activestate.com/recipes/576694/ }}}
|
||||
|
||||
## kca:
|
||||
print OrderedSet('simsalabim')[1]
|
||||
print(OrderedSet('simsalabim')[1])
|
||||
|
||||
# Test case for exception at shutdown (yes, really...)
|
||||
x = OrderedSet('simsalabim')
|
||||
|
@ -6,7 +6,7 @@ Created on 15.07.2011
|
||||
|
||||
from asyncore import dispatcher, loop
|
||||
from socket import AF_INET, SOCK_STREAM, error
|
||||
from sockethelper import socket
|
||||
from .sockethelper import socket
|
||||
from futile.exc import errorstr
|
||||
from collections import namedtuple
|
||||
import sys
|
||||
@ -38,9 +38,9 @@ def test_port(host, port, family = AF_INET, type = SOCK_STREAM):
|
||||
try:
|
||||
with socket(family, type) as s:
|
||||
s.connect((host, port))
|
||||
except error, e:
|
||||
except error as e:
|
||||
return TestResult(False, "%s (%d)" % (e.strerror, e.errno))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
return TestResult(False, errorstr(e))
|
||||
return TestResult(True)
|
||||
|
||||
|
@ -285,7 +285,7 @@ class RestClient(LoggerMixin):
|
||||
req.end()
|
||||
|
||||
except Exception as e:
|
||||
print "Exception triggered: %s"%e
|
||||
print("Exception triggered: %s"%e)
|
||||
promise.reject(e)
|
||||
|
||||
return promise
|
||||
|
@ -39,7 +39,7 @@ class HTTPSMixin(LoggerMixin):
|
||||
def get_request(self):
|
||||
try:
|
||||
return self.socket.accept()
|
||||
except error, e:
|
||||
except error as e:
|
||||
self.logger.exception("Error during accept(): %s", e)
|
||||
raise
|
||||
|
||||
|
@ -30,10 +30,10 @@ Date: 7 Mar 2004
|
||||
# it doesn't play nice with other types that implement
|
||||
# __radd__(). Test this.
|
||||
|
||||
from __future__ import generators
|
||||
|
||||
|
||||
def quote(p):
|
||||
from urllib2 import quote
|
||||
from urllib.parse import quote
|
||||
return quote(p, "")
|
||||
|
||||
|
||||
@ -46,15 +46,15 @@ __all__ = ['path']
|
||||
_base = str
|
||||
try:
|
||||
if os.path.supports_unicode_filenames:
|
||||
_base = unicode
|
||||
_base = str
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# Pre-2.3 workaround for basestring.
|
||||
try:
|
||||
basestring
|
||||
str
|
||||
except NameError:
|
||||
basestring = (str, unicode)
|
||||
str = (str, str)
|
||||
|
||||
# Universal newline support
|
||||
_textmode = 'r'
|
||||
@ -403,7 +403,7 @@ class path(_base):
|
||||
For example, path('/users').glob('*/bin/*') returns a list
|
||||
of all the files users have in their bin directories.
|
||||
"""
|
||||
return map(path, glob.glob(_base(self / pattern)))
|
||||
return list(map(path, glob.glob(_base(self / pattern))))
|
||||
|
||||
|
||||
# --- Reading or writing an entire file at once.
|
||||
@ -467,11 +467,11 @@ class path(_base):
|
||||
t = f.read()
|
||||
finally:
|
||||
f.close()
|
||||
return (t.replace(u'\r\n', u'\n')
|
||||
.replace(u'\r\x85', u'\n')
|
||||
.replace(u'\r', u'\n')
|
||||
.replace(u'\x85', u'\n')
|
||||
.replace(u'\u2028', u'\n'))
|
||||
return (t.replace('\r\n', '\n')
|
||||
.replace('\r\x85', '\n')
|
||||
.replace('\r', '\n')
|
||||
.replace('\x85', '\n')
|
||||
.replace('\u2028', '\n'))
|
||||
|
||||
def write_text(self, text, encoding=None, errors='strict', linesep=os.linesep, append=False):
|
||||
""" Write the given text to this file.
|
||||
@ -518,7 +518,7 @@ class path(_base):
|
||||
|
||||
This applies to Unicode text the same as to 8-bit text, except
|
||||
there are three additional standard Unicode end-of-line sequences:
|
||||
u'\x85', u'\r\x85', and u'\u2028'.
|
||||
u'\x85', u'\r\x85', and u'\\u2028'.
|
||||
|
||||
(This is slightly different from when you open a file for
|
||||
writing with fopen(filename, "w") in C or file(filename, 'w')
|
||||
@ -537,16 +537,16 @@ class path(_base):
|
||||
conversion.
|
||||
|
||||
"""
|
||||
if isinstance(text, unicode):
|
||||
if isinstance(text, str):
|
||||
if linesep is not None:
|
||||
# Convert all standard end-of-line sequences to
|
||||
# ordinary newline characters.
|
||||
text = (text.replace(u'\r\n', u'\n')
|
||||
.replace(u'\r\x85', u'\n')
|
||||
.replace(u'\r', u'\n')
|
||||
.replace(u'\x85', u'\n')
|
||||
.replace(u'\u2028', u'\n'))
|
||||
text = text.replace(u'\n', linesep)
|
||||
text = (text.replace('\r\n', '\n')
|
||||
.replace('\r\x85', '\n')
|
||||
.replace('\r', '\n')
|
||||
.replace('\x85', '\n')
|
||||
.replace('\u2028', '\n'))
|
||||
text = text.replace('\n', linesep)
|
||||
if encoding is None:
|
||||
encoding = sys.getdefaultencoding()
|
||||
bytes = text.encode(encoding, errors)
|
||||
@ -608,7 +608,7 @@ class path(_base):
|
||||
linesep - The desired line-ending. This line-ending is
|
||||
applied to every line. If a line already has any
|
||||
standard line ending ('\r', '\n', '\r\n', u'\x85',
|
||||
u'\r\x85', u'\u2028'), that will be stripped off and
|
||||
u'\r\x85', u'\\u2028'), that will be stripped off and
|
||||
this will be used instead. The default is os.linesep,
|
||||
which is platform-dependent ('\r\n' on Windows, '\n' on
|
||||
Unix, etc.) Specify None to write the lines as-is,
|
||||
@ -629,15 +629,15 @@ class path(_base):
|
||||
f = self.open(mode)
|
||||
try:
|
||||
for line in lines:
|
||||
isUnicode = isinstance(line, unicode)
|
||||
isUnicode = isinstance(line, str)
|
||||
if linesep is not None:
|
||||
# Strip off any existing line-end and add the
|
||||
# specified linesep string.
|
||||
if isUnicode:
|
||||
if line[-2:] in (u'\r\n', u'\x0d\x85'):
|
||||
if line[-2:] in ('\r\n', '\x0d\x85'):
|
||||
line = line[:-2]
|
||||
elif line[-1:] in (u'\r', u'\n',
|
||||
u'\x85', u'\u2028'):
|
||||
elif line[-1:] in ('\r', '\n',
|
||||
'\x85', '\u2028'):
|
||||
line = line[:-1]
|
||||
else:
|
||||
if line[-2:] == '\r\n':
|
||||
@ -754,10 +754,10 @@ class path(_base):
|
||||
os.renames(self, new)
|
||||
# --- Create/delete operations on directories
|
||||
|
||||
def mkdir(self, mode=0750):
|
||||
def mkdir(self, mode=0o750):
|
||||
os.mkdir(self, mode)
|
||||
|
||||
def makedirs(self, mode=0750):
|
||||
def makedirs(self, mode=0o750):
|
||||
os.makedirs(self, mode)
|
||||
|
||||
def rmdir(self):
|
||||
@ -769,7 +769,7 @@ class path(_base):
|
||||
|
||||
# --- Modifying operations on files
|
||||
|
||||
def touch(self, mode = 0640):
|
||||
def touch(self, mode = 0o640):
|
||||
""" Set the access/modified times of this file to the current time.
|
||||
Create the file if it does not exist.
|
||||
"""
|
||||
@ -823,15 +823,15 @@ class path(_base):
|
||||
if not self.isfile():
|
||||
raise Exception("Not a file: '%s'" % (self, ))
|
||||
|
||||
def forcedir(self, mode = 0750):
|
||||
def forcedir(self, mode = 0o750):
|
||||
if not self.isdir():
|
||||
if self.exists():
|
||||
raise Exception("Not a directory: '%s'" % (self, ))
|
||||
self.makedirs(mode)
|
||||
|
||||
def forcefile(self, mode = 0640):
|
||||
def forcefile(self, mode = 0o640):
|
||||
if not self.exists():
|
||||
return self.touch(mode = 0640)
|
||||
return self.touch(mode = 0o640)
|
||||
if not self.isfile():
|
||||
raise Exception("Not a file: %s" % (self ,))
|
||||
|
||||
|
@ -28,7 +28,7 @@ class AbstractXMLSerializer(LoggerMixin):
|
||||
return XML(input)
|
||||
else:
|
||||
return ElementTree().parse(input)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._handle_parse_error(e)
|
||||
raise ParseError(e)
|
||||
|
||||
|
@ -86,7 +86,7 @@ class CheckPIDFileController(DaemonController):
|
||||
try:
|
||||
os.kill(pid, 0)
|
||||
return True
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ESRCH:
|
||||
return False
|
||||
raise
|
||||
|
@ -2,7 +2,7 @@
|
||||
Interworking Proxy for Cul868 devices.
|
||||
"""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
__version__ = "1.3.0"
|
||||
__description__ = "The OpenMTC Cul868IPE"
|
||||
__author_name__ = "Ronny Kreuch"
|
||||
__author_mail__ = "ronny.kreuch@fokus.fraunhofer.de"
|
||||
|
1
openmtc-gevent/requirements.txt
Symbolic link
1
openmtc-gevent/requirements.txt
Symbolic link
@ -0,0 +1 @@
|
||||
dependencies.txt
|
@ -5,7 +5,7 @@ import sys
|
||||
import os
|
||||
import gevent.monkey
|
||||
|
||||
if 'threading' in sys.modules and not os.environ.get('SUPPORT_GEVENT'):
|
||||
if 'threading' in sys.modules and not os.environ.get('GEVENT_SUPPORT'):
|
||||
raise Exception('threading module loaded before monkey patching in '
|
||||
'gevent_main!')
|
||||
|
||||
|
15
roadmap.md
Normal file
15
roadmap.md
Normal file
@ -0,0 +1,15 @@
|
||||
## Short Term
|
||||
onem2m Release 2a compatibility
|
||||
Group Resource
|
||||
Pub/Sub improvements (rateLimit and batchNotify)
|
||||
Persistence Enhancement
|
||||
|
||||
## Medium Term
|
||||
onem2m Release 3 compatibility
|
||||
Announcements
|
||||
FlexContainer Resource
|
||||
Node Resource
|
||||
|
||||
## Long Term
|
||||
CoAP(s) & MQTTS
|
||||
XML
|
@ -13,7 +13,7 @@ from utils import (get_packages, OpenMTCSdist, OpenMTCBuildPy,
|
||||
|
||||
# name and version
|
||||
SETUP_NAME = "openmtc-all"
|
||||
SETUP_VERSION = "1.2.0"
|
||||
SETUP_VERSION = "1.3.0"
|
||||
SETUP_DESCRIPTION = "The OpenMTC Backend and Gateway (GEvent version)"
|
||||
|
||||
# meta
|
||||
@ -26,18 +26,18 @@ SETUP_LICENSE = "Fraunhofer FOKUS proprietary"
|
||||
SETUP_REQUIRES = [
|
||||
"urllib3", "gevent (>=1.0)", "iso8601 (>=0.1.5)", "werkzeug (>=0.9)",
|
||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||
"flask", "pyxb (==1.2.3)", "enum34", "dtls", "geventhttpclient",
|
||||
"flask", "enum34", "geventhttpclient",
|
||||
# server only
|
||||
"funcy", "netifaces", "decorator", "mimeparse", "coapthon", "rdflib",
|
||||
"fyzz", "yapps", "paho_mqtt"
|
||||
"yapps", "paho_mqtt"
|
||||
]
|
||||
SETUP_INSTALL_REQUIRES = [
|
||||
"urllib3", "gevent >= 1.0", "iso8601 >= 0.1.5", "werkzeug >= 0.9",
|
||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||
"flask", "pyxb == 1.2.3", "enum34", "dtls", "geventhttpclient",
|
||||
"flask", "enum34", "geventhttpclient",
|
||||
# server only
|
||||
"funcy", "netifaces", "decorator", "mimeparse", "coapthon", "rdflib",
|
||||
"fyzz", "yapps", "paho_mqtt"
|
||||
"yapps", "paho_mqtt"
|
||||
]
|
||||
|
||||
# packages
|
||||
|
@ -7,7 +7,7 @@ from utils import get_packages, OpenMTCSdist
|
||||
# name and version
|
||||
NAME = "sdk"
|
||||
SETUP_NAME = "openmtc-" + NAME
|
||||
SETUP_VERSION = "1.2.0"
|
||||
SETUP_VERSION = "1.3.0"
|
||||
SETUP_DESCRIPTION = "The OpenMTC Python SDK"
|
||||
|
||||
# meta
|
||||
@ -20,12 +20,12 @@ SETUP_LICENSE = "Fraunhofer FOKUS proprietary"
|
||||
SETUP_REQUIRES = [
|
||||
"urllib3", "gevent (>=1.0)", "iso8601 (>=0.1.5)", "werkzeug (>=0.9)",
|
||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||
"flask", "pyxb (==1.2.3)", "enum34", "dtls", "geventhttpclient"
|
||||
"flask", "enum34", "geventhttpclient"
|
||||
]
|
||||
SETUP_INSTALL_REQUIRES = [
|
||||
"urllib3", "gevent >= 1.0", "iso8601 >= 0.1.5", "werkzeug >= 0.9",
|
||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||
"flask", "pyxb == 1.2.3", "enum34", "dtls", "geventhttpclient"
|
||||
"flask", "enum34", "geventhttpclient"
|
||||
]
|
||||
|
||||
# packages
|
||||
|
Reference in New Issue
Block a user