mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2025-06-29 18:22:46 +00:00
Compare commits
33 Commits
feature-py
...
test-debia
Author | SHA1 | Date | |
---|---|---|---|
6fa4019859 | |||
bee1b173cd | |||
2e6ad886f2 | |||
5bfd290bd7 | |||
f42f056690 | |||
08d953cf0f | |||
0512a719a6 | |||
7da88edcb0 | |||
bfca09e9a3 | |||
13fda6b847 | |||
6626504bc5 | |||
8963d937a8 | |||
af30e9cfe4 | |||
65d8454c08 | |||
0338f8cbcc | |||
29e638b0bb | |||
fe018af17b | |||
fda2561bd0 | |||
6107606068 | |||
c485bd078b | |||
e2c9ced8c2 | |||
be4c31a1ef | |||
79e7a22f98 | |||
e030d9c225 | |||
e493d1ecff | |||
fef2b03b5b | |||
c373a1fe8e | |||
5b6255d088 | |||
e7ec483aba | |||
f638e9a591 | |||
18bc6d0dd4 | |||
9e49213546 | |||
c60ece6278 |
40
.travis.yml
40
.travis.yml
@ -1,8 +1,12 @@
|
|||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
dist: xenial
|
||||||
before_script:
|
before_script:
|
||||||
- sudo apt update
|
- sudo apt update
|
||||||
- sudo apt install qemu-user-static
|
- 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"
|
||||||
- "./create-binary-docker backend -a arm"
|
- "./create-binary-docker backend -a arm"
|
||||||
- "./create-binary-docker gateway"
|
- "./create-binary-docker gateway"
|
||||||
@ -13,24 +17,24 @@ before_script:
|
|||||||
- "./create-binary-docker influxdbapp -a arm"
|
- "./create-binary-docker influxdbapp -a arm"
|
||||||
- "./create-binary-docker cul868ipe"
|
- "./create-binary-docker cul868ipe"
|
||||||
- "./create-binary-docker cul868ipe -a arm"
|
- "./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:
|
script:
|
||||||
- docker tag openmtc/orioncontextbroker-amd64 openmtc/orion-context-broker-app-amd64
|
- 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/orioncontextbroker-arm openmtc/orion-context-broker-app-arm
|
||||||
- docker tag openmtc/cul868ipe-amd64 openmtc/cul868-ipe-amd64
|
- docker tag openmtc/cul868ipe-amd64 openmtc/cul868-ipe-amd64
|
||||||
- docker tag openmtc/cul868ipe-arm openmtc/cul868-ipe-arm
|
- docker tag openmtc/cul868ipe-arm openmtc/cul868-ipe-arm
|
||||||
- docker tag openmtc/influxdbapp-amd64 openmtc/influxdb-app-amd64
|
- docker tag openmtc/influxdbapp-amd64 openmtc/influxdb-app-amd64
|
||||||
- docker tag openmtc/influxdbapp-arm openmtc/influxdb-app-arm
|
- docker tag openmtc/influxdbapp-arm openmtc/influxdb-app-arm
|
||||||
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
|
- docker logs gateway
|
||||||
- docker push openmtc/backend-amd64
|
- docker logs backend
|
||||||
- docker push openmtc/backend-arm
|
after_script:
|
||||||
- docker push openmtc/gateway-amd64
|
- pyresttest http://localhost:8000 tests/interoperability/basic.yaml
|
||||||
- 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
|
|
||||||
env:
|
env:
|
||||||
matrix:
|
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=
|
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_failure:
|
||||||
|
- docker logs backend
|
||||||
|
- docker logs gateway
|
@ -5,7 +5,7 @@ from enum import Enum
|
|||||||
from iso8601 import parse_date, ParseError
|
from iso8601 import parse_date, ParseError
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
from futile import basestring, issubclass, NOT_SET
|
from futile import issubclass, NOT_SET
|
||||||
from futile.logging import LoggerMixin
|
from futile.logging import LoggerMixin
|
||||||
from openmtc.model.exc import ModelError, ModelTypeError
|
from openmtc.model.exc import ModelError, ModelTypeError
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ if [ ${#find_result[*]} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${#find_result[*]} -gt 1 ]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ get_target_from_setup_file ()
|
|||||||
local module_name=${setup_file%.py}
|
local module_name=${setup_file%.py}
|
||||||
|
|
||||||
cd ${working_dir}
|
cd ${working_dir}
|
||||||
python - << END_OF_PYTHON
|
python3 - << END_OF_PYTHON
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
setup = import_module('${module_name}', '${module_name}')
|
setup = import_module('${module_name}', '${module_name}')
|
||||||
print("%s-%s" % (setup.SETUP_NAME, setup.SETUP_VERSION))
|
print("%s-%s" % (setup.SETUP_NAME, setup.SETUP_VERSION))
|
||||||
@ -92,7 +92,7 @@ rm -rf ${working_dir}/build
|
|||||||
|
|
||||||
# build
|
# build
|
||||||
cd ${working_dir}
|
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
|
# clean up after
|
||||||
rm -rf ${working_dir}/build
|
rm -rf ${working_dir}/build
|
||||||
@ -113,14 +113,14 @@ rm ${log_file}
|
|||||||
################################################################################
|
################################################################################
|
||||||
# clean binary_package
|
# clean binary_package
|
||||||
binary_archive="${working_dir}/dist/${binary_prefix}.docker.tar.gz"
|
binary_archive="${working_dir}/dist/${binary_prefix}.docker.tar.gz"
|
||||||
printf "### Stripping .py files..."
|
#printf "### Stripping .py files..."
|
||||||
cp ${target_file} ${binary_archive}
|
cp ${target_file} ${binary_archive}
|
||||||
gzip -d ${binary_archive}
|
#gzip -d ${binary_archive}
|
||||||
tar --wildcards --delete -f ${binary_archive%".gz"} "*.py"
|
#tar --wildcards --delete -f ${binary_archive%".gz"} "*.py"
|
||||||
gzip ${binary_archive%".gz"}
|
#gzip ${binary_archive%".gz"}
|
||||||
printf "done\n"
|
#printf "done\n"
|
||||||
rm ${target_file}
|
rm ${target_file}
|
||||||
printf "### Created binary archive at %s.\n" ${binary_archive}
|
#printf "### Created binary archive at %s.\n" ${binary_archive}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# set correct permissions
|
# set correct permissions
|
||||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
|||||||
|
|
||||||
# install openmtc dependencies
|
# install openmtc dependencies
|
||||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
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
|
# install openmtc-all
|
||||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
|||||||
|
|
||||||
# install openmtc dependencies
|
# install openmtc dependencies
|
||||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
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
|
# install openmtc-all
|
||||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
# Set the base image to use debian
|
# Set the base image to use debian
|
||||||
FROM debian:jessie
|
FROM debian:stretch
|
||||||
|
|
||||||
# Set the file maintainer
|
# Set the file maintainer
|
||||||
MAINTAINER rst/tgu
|
MAINTAINER rst/tgu
|
||||||
@ -20,8 +20,9 @@ RUN printf "Starting update...\n" && \
|
|||||||
build-essential \
|
build-essential \
|
||||||
netbase \
|
netbase \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
python-pip \
|
python3-setuptools \
|
||||||
python-dev \
|
python3-pip \
|
||||||
|
python3-dev \
|
||||||
jq > /dev/null && \
|
jq > /dev/null && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
printf "Installation and cleanup finished.\n"
|
printf "Installation and cleanup finished.\n"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
# Set the base image to use debian
|
# Set the base image to use debian
|
||||||
FROM resin/rpi-raspbian:jessie
|
FROM resin/rpi-raspbian:stretch
|
||||||
|
|
||||||
# Set the file maintainer
|
# Set the file maintainer
|
||||||
MAINTAINER rst/tgu
|
MAINTAINER rst/tgu
|
||||||
@ -20,8 +20,9 @@ RUN printf "Starting update...\n" && \
|
|||||||
build-essential \
|
build-essential \
|
||||||
netbase \
|
netbase \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
python-pip \
|
python3-setuptools \
|
||||||
python-dev \
|
python3-pip \
|
||||||
|
python3-dev \
|
||||||
jq > /dev/null && \
|
jq > /dev/null && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
printf "Installation and cleanup finished.\n"
|
printf "Installation and cleanup finished.\n"
|
||||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
|||||||
|
|
||||||
# install openmtc dependencies
|
# install openmtc dependencies
|
||||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
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
|
# install openmtc-all
|
||||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||||
|
@ -12,7 +12,7 @@ MAINTAINER rst/tgu
|
|||||||
|
|
||||||
# install openmtc dependencies
|
# install openmtc dependencies
|
||||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
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
|
# install openmtc-all
|
||||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||||
|
@ -11,11 +11,11 @@ ENV MOD_NAME=sdk
|
|||||||
MAINTAINER rst/tgu
|
MAINTAINER rst/tgu
|
||||||
|
|
||||||
# update pip to latest version
|
# update pip to latest version
|
||||||
RUN pip install --upgrade pip
|
RUN pip3 install --upgrade pip
|
||||||
|
|
||||||
# install openmtc dependencies
|
# install openmtc dependencies
|
||||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
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
|
# install openmtc-sdk
|
||||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
||||||
|
@ -11,11 +11,11 @@ ENV MOD_NAME=sdk
|
|||||||
MAINTAINER rst/tgu
|
MAINTAINER rst/tgu
|
||||||
|
|
||||||
# update pip to latest version
|
# update pip to latest version
|
||||||
RUN pip install --upgrade pip setuptools
|
RUN pip3 install --upgrade pip setuptools
|
||||||
|
|
||||||
# install openmtc dependencies
|
# install openmtc dependencies
|
||||||
COPY tmp/$MOD_NAME-dependencies.txt /tmp/requirements.txt
|
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
|
# install openmtc-sdk
|
||||||
COPY tmp/openmtc-$MOD_NAME.tar.gz /tmp/openmtc-$MOD_NAME.tar.gz
|
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/ }}}
|
## end of http://code.activestate.com/recipes/576694/ }}}
|
||||||
|
|
||||||
## kca:
|
## kca:
|
||||||
print OrderedSet('simsalabim')[1]
|
print(OrderedSet('simsalabim')[1])
|
||||||
|
|
||||||
# Test case for exception at shutdown (yes, really...)
|
# Test case for exception at shutdown (yes, really...)
|
||||||
x = OrderedSet('simsalabim')
|
x = OrderedSet('simsalabim')
|
||||||
|
@ -6,7 +6,7 @@ Created on 15.07.2011
|
|||||||
|
|
||||||
from asyncore import dispatcher, loop
|
from asyncore import dispatcher, loop
|
||||||
from socket import AF_INET, SOCK_STREAM, error
|
from socket import AF_INET, SOCK_STREAM, error
|
||||||
from sockethelper import socket
|
from .sockethelper import socket
|
||||||
from futile.exc import errorstr
|
from futile.exc import errorstr
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import sys
|
import sys
|
||||||
@ -38,9 +38,9 @@ def test_port(host, port, family = AF_INET, type = SOCK_STREAM):
|
|||||||
try:
|
try:
|
||||||
with socket(family, type) as s:
|
with socket(family, type) as s:
|
||||||
s.connect((host, port))
|
s.connect((host, port))
|
||||||
except error, e:
|
except error as e:
|
||||||
return TestResult(False, "%s (%d)" % (e.strerror, e.errno))
|
return TestResult(False, "%s (%d)" % (e.strerror, e.errno))
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
return TestResult(False, errorstr(e))
|
return TestResult(False, errorstr(e))
|
||||||
return TestResult(True)
|
return TestResult(True)
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ class RestClient(LoggerMixin):
|
|||||||
req.end()
|
req.end()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "Exception triggered: %s"%e
|
print("Exception triggered: %s"%e)
|
||||||
promise.reject(e)
|
promise.reject(e)
|
||||||
|
|
||||||
return promise
|
return promise
|
||||||
|
@ -39,7 +39,7 @@ class HTTPSMixin(LoggerMixin):
|
|||||||
def get_request(self):
|
def get_request(self):
|
||||||
try:
|
try:
|
||||||
return self.socket.accept()
|
return self.socket.accept()
|
||||||
except error, e:
|
except error as e:
|
||||||
self.logger.exception("Error during accept(): %s", e)
|
self.logger.exception("Error during accept(): %s", e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ Date: 7 Mar 2004
|
|||||||
# it doesn't play nice with other types that implement
|
# it doesn't play nice with other types that implement
|
||||||
# __radd__(). Test this.
|
# __radd__(). Test this.
|
||||||
|
|
||||||
from __future__ import generators
|
|
||||||
|
|
||||||
def quote(p):
|
def quote(p):
|
||||||
from urllib2 import quote
|
from urllib.parse import quote
|
||||||
return quote(p, "")
|
return quote(p, "")
|
||||||
|
|
||||||
|
|
||||||
@ -46,15 +46,15 @@ __all__ = ['path']
|
|||||||
_base = str
|
_base = str
|
||||||
try:
|
try:
|
||||||
if os.path.supports_unicode_filenames:
|
if os.path.supports_unicode_filenames:
|
||||||
_base = unicode
|
_base = str
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Pre-2.3 workaround for basestring.
|
# Pre-2.3 workaround for basestring.
|
||||||
try:
|
try:
|
||||||
basestring
|
str
|
||||||
except NameError:
|
except NameError:
|
||||||
basestring = (str, unicode)
|
str = (str, str)
|
||||||
|
|
||||||
# Universal newline support
|
# Universal newline support
|
||||||
_textmode = 'r'
|
_textmode = 'r'
|
||||||
@ -403,7 +403,7 @@ class path(_base):
|
|||||||
For example, path('/users').glob('*/bin/*') returns a list
|
For example, path('/users').glob('*/bin/*') returns a list
|
||||||
of all the files users have in their bin directories.
|
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.
|
# --- Reading or writing an entire file at once.
|
||||||
@ -467,11 +467,11 @@ class path(_base):
|
|||||||
t = f.read()
|
t = f.read()
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
return (t.replace(u'\r\n', u'\n')
|
return (t.replace('\r\n', '\n')
|
||||||
.replace(u'\r\x85', u'\n')
|
.replace('\r\x85', '\n')
|
||||||
.replace(u'\r', u'\n')
|
.replace('\r', '\n')
|
||||||
.replace(u'\x85', u'\n')
|
.replace('\x85', '\n')
|
||||||
.replace(u'\u2028', u'\n'))
|
.replace('\u2028', '\n'))
|
||||||
|
|
||||||
def write_text(self, text, encoding=None, errors='strict', linesep=os.linesep, append=False):
|
def write_text(self, text, encoding=None, errors='strict', linesep=os.linesep, append=False):
|
||||||
""" Write the given text to this file.
|
""" 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
|
This applies to Unicode text the same as to 8-bit text, except
|
||||||
there are three additional standard Unicode end-of-line sequences:
|
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
|
(This is slightly different from when you open a file for
|
||||||
writing with fopen(filename, "w") in C or file(filename, 'w')
|
writing with fopen(filename, "w") in C or file(filename, 'w')
|
||||||
@ -537,16 +537,16 @@ class path(_base):
|
|||||||
conversion.
|
conversion.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if isinstance(text, unicode):
|
if isinstance(text, str):
|
||||||
if linesep is not None:
|
if linesep is not None:
|
||||||
# Convert all standard end-of-line sequences to
|
# Convert all standard end-of-line sequences to
|
||||||
# ordinary newline characters.
|
# ordinary newline characters.
|
||||||
text = (text.replace(u'\r\n', u'\n')
|
text = (text.replace('\r\n', '\n')
|
||||||
.replace(u'\r\x85', u'\n')
|
.replace('\r\x85', '\n')
|
||||||
.replace(u'\r', u'\n')
|
.replace('\r', '\n')
|
||||||
.replace(u'\x85', u'\n')
|
.replace('\x85', '\n')
|
||||||
.replace(u'\u2028', u'\n'))
|
.replace('\u2028', '\n'))
|
||||||
text = text.replace(u'\n', linesep)
|
text = text.replace('\n', linesep)
|
||||||
if encoding is None:
|
if encoding is None:
|
||||||
encoding = sys.getdefaultencoding()
|
encoding = sys.getdefaultencoding()
|
||||||
bytes = text.encode(encoding, errors)
|
bytes = text.encode(encoding, errors)
|
||||||
@ -608,7 +608,7 @@ class path(_base):
|
|||||||
linesep - The desired line-ending. This line-ending is
|
linesep - The desired line-ending. This line-ending is
|
||||||
applied to every line. If a line already has any
|
applied to every line. If a line already has any
|
||||||
standard line ending ('\r', '\n', '\r\n', u'\x85',
|
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,
|
this will be used instead. The default is os.linesep,
|
||||||
which is platform-dependent ('\r\n' on Windows, '\n' on
|
which is platform-dependent ('\r\n' on Windows, '\n' on
|
||||||
Unix, etc.) Specify None to write the lines as-is,
|
Unix, etc.) Specify None to write the lines as-is,
|
||||||
@ -629,15 +629,15 @@ class path(_base):
|
|||||||
f = self.open(mode)
|
f = self.open(mode)
|
||||||
try:
|
try:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
isUnicode = isinstance(line, unicode)
|
isUnicode = isinstance(line, str)
|
||||||
if linesep is not None:
|
if linesep is not None:
|
||||||
# Strip off any existing line-end and add the
|
# Strip off any existing line-end and add the
|
||||||
# specified linesep string.
|
# specified linesep string.
|
||||||
if isUnicode:
|
if isUnicode:
|
||||||
if line[-2:] in (u'\r\n', u'\x0d\x85'):
|
if line[-2:] in ('\r\n', '\x0d\x85'):
|
||||||
line = line[:-2]
|
line = line[:-2]
|
||||||
elif line[-1:] in (u'\r', u'\n',
|
elif line[-1:] in ('\r', '\n',
|
||||||
u'\x85', u'\u2028'):
|
'\x85', '\u2028'):
|
||||||
line = line[:-1]
|
line = line[:-1]
|
||||||
else:
|
else:
|
||||||
if line[-2:] == '\r\n':
|
if line[-2:] == '\r\n':
|
||||||
@ -754,10 +754,10 @@ class path(_base):
|
|||||||
os.renames(self, new)
|
os.renames(self, new)
|
||||||
# --- Create/delete operations on directories
|
# --- Create/delete operations on directories
|
||||||
|
|
||||||
def mkdir(self, mode=0750):
|
def mkdir(self, mode=0o750):
|
||||||
os.mkdir(self, mode)
|
os.mkdir(self, mode)
|
||||||
|
|
||||||
def makedirs(self, mode=0750):
|
def makedirs(self, mode=0o750):
|
||||||
os.makedirs(self, mode)
|
os.makedirs(self, mode)
|
||||||
|
|
||||||
def rmdir(self):
|
def rmdir(self):
|
||||||
@ -769,7 +769,7 @@ class path(_base):
|
|||||||
|
|
||||||
# --- Modifying operations on files
|
# --- 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.
|
""" Set the access/modified times of this file to the current time.
|
||||||
Create the file if it does not exist.
|
Create the file if it does not exist.
|
||||||
"""
|
"""
|
||||||
@ -823,15 +823,15 @@ class path(_base):
|
|||||||
if not self.isfile():
|
if not self.isfile():
|
||||||
raise Exception("Not a file: '%s'" % (self, ))
|
raise Exception("Not a file: '%s'" % (self, ))
|
||||||
|
|
||||||
def forcedir(self, mode = 0750):
|
def forcedir(self, mode = 0o750):
|
||||||
if not self.isdir():
|
if not self.isdir():
|
||||||
if self.exists():
|
if self.exists():
|
||||||
raise Exception("Not a directory: '%s'" % (self, ))
|
raise Exception("Not a directory: '%s'" % (self, ))
|
||||||
self.makedirs(mode)
|
self.makedirs(mode)
|
||||||
|
|
||||||
def forcefile(self, mode = 0640):
|
def forcefile(self, mode = 0o640):
|
||||||
if not self.exists():
|
if not self.exists():
|
||||||
return self.touch(mode = 0640)
|
return self.touch(mode = 0o640)
|
||||||
if not self.isfile():
|
if not self.isfile():
|
||||||
raise Exception("Not a file: %s" % (self ,))
|
raise Exception("Not a file: %s" % (self ,))
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class AbstractXMLSerializer(LoggerMixin):
|
|||||||
return XML(input)
|
return XML(input)
|
||||||
else:
|
else:
|
||||||
return ElementTree().parse(input)
|
return ElementTree().parse(input)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self._handle_parse_error(e)
|
self._handle_parse_error(e)
|
||||||
raise ParseError(e)
|
raise ParseError(e)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class CheckPIDFileController(DaemonController):
|
|||||||
try:
|
try:
|
||||||
os.kill(pid, 0)
|
os.kill(pid, 0)
|
||||||
return True
|
return True
|
||||||
except OSError, e:
|
except OSError as e:
|
||||||
if e.errno == errno.ESRCH:
|
if e.errno == errno.ESRCH:
|
||||||
return False
|
return False
|
||||||
raise
|
raise
|
||||||
|
@ -5,7 +5,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import gevent.monkey
|
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 '
|
raise Exception('threading module loaded before monkey patching in '
|
||||||
'gevent_main!')
|
'gevent_main!')
|
||||||
|
|
||||||
|
@ -26,18 +26,18 @@ SETUP_LICENSE = "Fraunhofer FOKUS proprietary"
|
|||||||
SETUP_REQUIRES = [
|
SETUP_REQUIRES = [
|
||||||
"urllib3", "gevent (>=1.0)", "iso8601 (>=0.1.5)", "werkzeug (>=0.9)",
|
"urllib3", "gevent (>=1.0)", "iso8601 (>=0.1.5)", "werkzeug (>=0.9)",
|
||||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||||
"flask", "pyxb (==1.2.3)", "enum34", "dtls", "geventhttpclient",
|
"flask", "enum34", "geventhttpclient",
|
||||||
# server only
|
# server only
|
||||||
"funcy", "netifaces", "decorator", "mimeparse", "coapthon", "rdflib",
|
"funcy", "netifaces", "decorator", "mimeparse", "coapthon", "rdflib",
|
||||||
"fyzz", "yapps", "paho_mqtt"
|
"yapps", "paho_mqtt"
|
||||||
]
|
]
|
||||||
SETUP_INSTALL_REQUIRES = [
|
SETUP_INSTALL_REQUIRES = [
|
||||||
"urllib3", "gevent >= 1.0", "iso8601 >= 0.1.5", "werkzeug >= 0.9",
|
"urllib3", "gevent >= 1.0", "iso8601 >= 0.1.5", "werkzeug >= 0.9",
|
||||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||||
"flask", "pyxb == 1.2.3", "enum34", "dtls", "geventhttpclient",
|
"flask", "enum34", "geventhttpclient",
|
||||||
# server only
|
# server only
|
||||||
"funcy", "netifaces", "decorator", "mimeparse", "coapthon", "rdflib",
|
"funcy", "netifaces", "decorator", "mimeparse", "coapthon", "rdflib",
|
||||||
"fyzz", "yapps", "paho_mqtt"
|
"yapps", "paho_mqtt"
|
||||||
]
|
]
|
||||||
|
|
||||||
# packages
|
# packages
|
||||||
|
@ -20,12 +20,12 @@ SETUP_LICENSE = "Fraunhofer FOKUS proprietary"
|
|||||||
SETUP_REQUIRES = [
|
SETUP_REQUIRES = [
|
||||||
"urllib3", "gevent (>=1.0)", "iso8601 (>=0.1.5)", "werkzeug (>=0.9)",
|
"urllib3", "gevent (>=1.0)", "iso8601 (>=0.1.5)", "werkzeug (>=0.9)",
|
||||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||||
"flask", "pyxb (==1.2.3)", "enum34", "dtls", "geventhttpclient"
|
"flask", "enum34", "geventhttpclient"
|
||||||
]
|
]
|
||||||
SETUP_INSTALL_REQUIRES = [
|
SETUP_INSTALL_REQUIRES = [
|
||||||
"urllib3", "gevent >= 1.0", "iso8601 >= 0.1.5", "werkzeug >= 0.9",
|
"urllib3", "gevent >= 1.0", "iso8601 >= 0.1.5", "werkzeug >= 0.9",
|
||||||
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
"blist", "simplejson", "ujson", "python_socketio", "gevent_websocket",
|
||||||
"flask", "pyxb == 1.2.3", "enum34", "dtls", "geventhttpclient"
|
"flask", "enum34", "geventhttpclient"
|
||||||
]
|
]
|
||||||
|
|
||||||
# packages
|
# packages
|
||||||
|
Reference in New Issue
Block a user