Skip to content

Commit d38a5be

Browse files
committed
Update build process
1 parent 25f80d6 commit d38a5be

12 files changed

Lines changed: 94 additions & 51 deletions

File tree

‎.travis.yml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ python:
1111
install:
1212
# - env
1313
# - make pip
14-
- make tests-deps
14+
- make VIRTUAL_ENV=$VIRTUAL_ENV pip
15+
- make VIRTUAL_ENV=$VIRTUAL_ENV update
16+
- make VIRTUAL_ENV=$VIRTUAL_ENV build
17+
- make VIRTUAL_ENV=$VIRTUAL_ENV install
18+
- make VIRTUAL_ENV=$VIRTUAL_ENV tests-deps
1519
# command to run tests
1620
script:
17-
- make update
18-
- make build
19-
- make install
2021
- nosetests --cover-package=libopenzwave,openzwave --with-coverage
2122
# package dependencies
2223
before_install:
2324
#- env
2425
#- sudo -E env
2526
- sudo apt-get update -y -qq
26-
- sudo -E make VIRTUAL_ENV=$VIRTUAL_ENV deps
27+
- sudo -E make VIRTUAL_ENV=$VIRTUAL_ENV debian-deps

‎Makefile‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ python_version_minor = $(word 2,${python_version_full})
3333
python_version_patch = $(word 3,${python_version_full})
3434
EASYPTH = /usr/local/lib/python${python_version_major}.${python_version_minor}/dist-packages/easy-install.pth
3535

36-
.PHONY: help clean all develop install uninstall cleandoc docs tests devtests pylint commit apt pip travis-deps update build deps
36+
.PHONY: help clean all develop install uninstall cleandoc docs tests devtests pylint commit apt pip debian-deps update build deps
3737

3838
help:
3939
@echo "Please use \`make <target>' where <target> is one of"
@@ -80,7 +80,7 @@ uninstall:
8080
${PYTHON_EXEC} setup-api.py develop --uninstall
8181
${PYTHON_EXEC} setup-manager.py develop --uninstall
8282
-rm -f libopenzwave.so
83-
-rm -f src-lib/liopenzwave.so
83+
-rm -f src-lib/libopenzwave.so
8484
-rm -f libopenzwave/liopenzwave.so
8585
-rm -Rf python_openzwave_api.egg-info/
8686
-rm -Rf src-api/python_openzwave_api.egg-info/
@@ -98,29 +98,30 @@ uninstall:
9898
#-[ -f ${EASYPTH} ] && [ ! -f ${EASYPTH}.back ] && cp ${EASYPTH} ${EASYPTH}.back
9999
#-[ -f ${EASYPTH} ] && cat ${EASYPTH} | sed -e "/.*python-openzwave.*/d" | tee ${EASYPTH} >/dev/null
100100

101-
deps :
101+
deps : debian-deps pip
102+
103+
debian-deps:
102104
@echo Installing dependencies for python : ${python_version_full}
103105
ifeq (${python_version_major},2)
104-
apt-get install -y python-pip python-dev
105-
apt-get install -y python-dev python-setuptools python-louie
106+
apt-get install -y python-pip python-dev cython python-docutils
107+
apt-get install -y python-setuptools python-louie
106108
endif
107109
ifeq (${python_version_major},3)
108-
-apt-get install -y python3-pip
110+
-apt-get install -y python3-pip cython3 python3-docutils
109111
-apt-get install -y python3-dev python3-setuptools
110112
endif
111113
apt-get install -y build-essential libudev-dev g++
112-
${PIP_EXEC} install setuptools
113-
${PIP_EXEC} install "Cython>=0.20"
114-
115-
travis-deps: deps
116114

117115
tests-deps:
118116
${PIP_EXEC} install nose-html
119117
${PIP_EXEC} install nose-progressive
120118
${PIP_EXEC} install nose
121119

122120
pip:
123-
${PIP_EXEC} install docutils
121+
#${PIP_EXEC} install docutils
122+
#${PIP_EXEC} install setuptools
123+
#The following line crashes with a core dump
124+
#${PIP_EXEC} install "Cython==0.22"
124125

125126
docs: cleandocs
126127
-mkdir -p docs/html/nosetests
@@ -202,4 +203,7 @@ openzwave:
202203

203204
openzwave/libopenzwave.a: openzwave
204205
sed -i '253s/.*//' openzwave/cpp/src/value_classes/ValueID.h
205-
cd openzwave && VERSION_REV=0 make
206+
#cd openzwave && VERSION_REV=0 make
207+
cd openzwave && make
208+
209+
tgz: clean build docs

‎pyozw_version.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@
2121
along with python-openzwave. If not, see http://www.gnu.org/licenses.
2222
2323
"""
24-
pyozw_version = '0.3.0'
24+
pyozw_version = '0.3.0-alpha1'
25+
26+
if __name__ == '__main__':
27+
print pyozw_version
28+

‎setup-lib.py‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
"""
2424
from os import name as os_name
2525
#from distutils.core import setup
26-
from setuptools import setup
27-
from distutils import extension
26+
from setuptools import setup, find_packages
27+
from distutils.extension import Extension
2828
#from Cython.Distutils import build_ext
29+
from Cython.Distutils import build_ext
2930
from Cython.Build import cythonize
3031
from platform import system as platform_system
3132
import glob
@@ -71,33 +72,37 @@ def data_files_config(target, source, pattern):
7172
ext_modules = [ ]
7273

7374
if os_name == 'nt':
74-
ext_modules = [extension.Extension("libopenzwave", ["src-lib/libopenzwave/libopenzwave.pyx"],
75+
ext_modules = [Extension("libopenzwave",
76+
sources=["src-lib/libopenzwave/libopenzwave.pyx"],
7577
libraries=['setupapi', 'stdc++'],
7678
language="c++",
7779
extra_objects=['openzwave/libopenzwave.a'],
78-
include_dirs=['openzwave/cpp/src', 'openzwave/cpp/src/value_classes', 'openzwave/cpp/src/platform', 'openzwave/cpp/build/windows']
80+
include_dirs=['openzwave/cpp/src', 'openzwave/cpp/src/value_classes', 'openzwave/cpp/src/platform', 'openzwave/cpp/build/windows', "src-lib/libopenzwave"]
7981
)]
8082
elif platform_system() == 'Darwin':
81-
ext_modules = [extension.Extension("libopenzwave", ["src-lib/libopenzwave/libopenzwave.pyx"],
83+
ext_modules = [Extension("libopenzwave",
84+
sources=["src-lib/libopenzwave/libopenzwave.pyx"],
8285
libraries=['stdc++'],
8386
language="c++",
8487
extra_link_args=['-framework', 'CoreFoundation', '-framework', 'IOKit'],
8588
extra_objects=['openzwave/libopenzwave.a'],
86-
include_dirs=['openzwave/cpp/src', 'openzwave/cpp/src/value_classes', 'openzwave/cpp/src/platform', 'openzwave/cpp/build/mac']
89+
include_dirs=['openzwave/cpp/src', 'openzwave/cpp/src/value_classes', 'openzwave/cpp/src/platform', 'openzwave/cpp/build/mac', "src-lib/libopenzwave"]
8790
)]
8891
elif DEBIAN_PACKAGE == True:
89-
ext_modules = [extension.Extension("libopenzwave", ["src-lib/libopenzwave/libopenzwave.pyx"],
92+
ext_modules = [Extension("libopenzwave",
93+
sources=["src-lib/libopenzwave/libopenzwave.pyx"],
9094
libraries=['udev', 'stdc++', 'openzwave'],
9195
language="c++",
9296
extra_objects=['/usr/libopenzwave.a'],
93-
include_dirs=['/usr/include/openzwave', '/usr/include/openzwave/value_classes', '/usr/include/openzwave/platform']
97+
include_dirs=['/usr/include/openzwave', '/usr/include/openzwave/value_classes', '/usr/include/openzwave/platform', "src-lib/libopenzwave"]
9498
)]
9599
else:
96-
ext_modules = [extension.Extension("libopenzwave", ["src-lib/libopenzwave/libopenzwave.pyx"],
100+
ext_modules = [Extension("libopenzwave",
101+
sources=["src-lib/libopenzwave/libopenzwave.pyx"],
97102
libraries=['udev', 'stdc++'],
98103
language="c++",
99104
extra_objects=['openzwave/libopenzwave.a'],
100-
include_dirs=['openzwave/cpp/src', 'openzwave/cpp/src/value_classes', 'openzwave/cpp/src/platform', 'openzwave/cpp/build/linux']
105+
include_dirs=['openzwave/cpp/src/', 'openzwave/cpp/src/value_classes/', 'openzwave/cpp/src/platform/', 'openzwave/cpp/build/linux/']
101106
)]
102107

103108
setup(
@@ -107,11 +112,11 @@ def data_files_config(target, source, pattern):
107112
version = pyozw_version,
108113
zip_safe = False,
109114
url='https://github.com/bibi21000/python-openzwave',
110-
#cmdclass = {'build_ext': build_ext},
111-
#ext_modules = ext_modules,
112-
ext_modules = cythonize(ext_modules),
115+
cmdclass = {'build_ext': build_ext},
116+
ext_modules = ext_modules,
117+
#ext_modules = cythonize(ext_modules),
113118
package_dir = {'' : 'src-lib'},
114119
#The following line install config drectory in share/python-openzwave
115120
data_files = data_files,
116-
packages = ['libopenzwave']
121+
packages = find_packages('src-lib', exclude=["scripts"]),
117122
)

‎src-api/openzwave/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
__license__ = """
33
4-
This file is part of **python-openzwave** project https://github.com/nechry/python-openzwave.
4+
This file is part of **python-openzwave** project https://github.com/bibi21000/python-openzwave.
55
66
License : GPL(v3)
77

‎src-lib/libopenzwave/driver.pxd‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ from libcpp cimport bool
2222

2323
cdef extern from "Driver.h" namespace "OpenZWave::Driver":
2424

25-
cdef enum ControllerInterface: # Specifies the controller's hardware interface
25+
cdef enum ControllerInterface: # Specifies the controller's hardware interface
2626
ControllerInterface_Unknown = 0
2727
ControllerInterface_Serial = 1 # Serial protocol
2828
ControllerInterface_Hid = 2 # Human interface device protocol
29-
29+
3030
cdef struct DriverData:
3131
uint32_t m_SOFCnt # Number of SOF bytes received
3232
uint32_t m_ACKWaiting # Number of unsolicited messages while waiting for an ACK

‎src-lib/libopenzwave/libopenzwave.pyx‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,20 @@ from libcpp.map cimport map, pair
2929
from libcpp cimport bool
3030
from libcpp.vector cimport vector
3131
from libc.stdint cimport uint16_t, uint32_t, uint64_t, int32_t, int16_t, uint8_t, int8_t
32-
from mylibc cimport string
33-
from vers cimport ozw_vers_major, ozw_vers_minor, ozw_vers_revision, ozw_version_string
3432
from libc.stdlib cimport malloc, free
33+
from mylibc cimport string
34+
#from vers cimport ozw_vers_major, ozw_vers_minor, ozw_vers_revision, ozw_version_string
3535
from mylibc cimport PyEval_InitThreads
3636
from node cimport NodeData_t, NodeData
3737
from node cimport SecurityFlag
3838
from driver cimport DriverData_t, DriverData
3939
from driver cimport ControllerCommand, ControllerState, ControllerError, pfnControllerCallback_t
4040
from notification cimport Notification, NotificationType, NotificationCode
41-
from notification cimport Type_Notification, Type_Group, Type_NodeEvent
42-
from notification cimport Type_CreateButton, Type_DeleteButton, Type_ButtonOn, Type_ButtonOff
43-
from notification cimport Type_SceneEvent
41+
from notification cimport Type_Notification, Type_Group, Type_NodeEvent, Type_CreateButton, Type_DeleteButton, Type_ButtonOn, Type_ButtonOff, Type_SceneEvent
4442
from notification cimport const_notification, pfnOnNotification_t
4543
from values cimport ValueGenre, ValueType, ValueID
4644
from options cimport Options, Create
4745
from manager cimport Manager, Create, Get
48-
from cython.operator cimport dereference
4946
from log cimport LogLevel
5047
import os
5148
import sys
@@ -929,7 +926,9 @@ Get a string containing the openzwave library version.
929926
:see: getLibraryVersion_, getPythonLibraryVersion_, getLibraryTypeName_
930927
931928
"""
932-
return "OpenZWave version %s" %(ozw_version_string)
929+
#return "OpenZWave version %s" %(ozw_version_string)
930+
cdef string c_string = self.manager.getVersionAsString()
931+
return c_string.c_str()
933932

934933
def getOzwLibraryVersionNumber(self):
935934
'''
@@ -940,7 +939,9 @@ _getOzwLibraryVersionNumber: Get the openzwave library version number.
940939
:see: getLibraryVersion_, getPythonLibraryVersion_, getLibraryTypeName_
941940
942941
'''
943-
return "%d.%d.%d" %(ozw_vers_major, ozw_vers_minor, ozw_vers_revision)
942+
#return "%d.%d.%d" %(ozw_vers_major, ozw_vers_minor, ozw_vers_revision)
943+
cdef string c_string = self.manager.getVersionAsString()
944+
return c_string.c_str()
944945

945946
def getLibraryTypeName(self, homeid):
946947
'''

‎src-lib/libopenzwave/manager.pxd‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ from mylibc cimport string
2424
from node cimport NodeData
2525
from driver cimport DriverData_t, DriverData
2626
from driver cimport ControllerInterface, ControllerCommand, ControllerState, pfnControllerCallback_t
27-
from notification cimport Notification, NotificationType
28-
from notification cimport Type_Notification, Type_Group, Type_NodeEvent
29-
from notification cimport const_notification, pfnOnNotification_t
27+
from notification cimport Notification, NotificationType, Type_Notification, Type_Group, Type_NodeEvent, const_notification, pfnOnNotification_t
3028
from values cimport ValueGenre, ValueType, ValueID
3129
from options cimport Options, Create
3230
from log cimport LogLevel
@@ -49,6 +47,7 @@ cdef extern from "Manager.h" namespace "OpenZWave":
4947
bint IsPrimaryController(uint32_t homeid)
5048
bint IsStaticUpdateController(uint32_t homeid)
5149
bint IsBridgeController(uint32_t homeid)
50+
string getVersionAsString()
5251
string GetLibraryVersion(uint32_t homeid)
5352
string GetLibraryTypeName(uint32_t homeid)
5453
int32_t GetSendQueueCount( uint32_t homeId )
@@ -166,7 +165,7 @@ cdef extern from "Manager.h" namespace "OpenZWave":
166165
void RemoveAssociation(uint32_t homeid, uint8_t nodeid, uint8_t groupidx, uint8_t targetnodeid)
167166
bool AddWatcher(pfnOnNotification_t notification, void* context)
168167
bool RemoveWatcher(pfnOnNotification_t notification, void* context)
169-
# void NotifyWatchers(Notification*)
168+
# void NotifyWatchers(Notification*)
170169
# // Controller Commands
171170
void ResetController(uint32_t homeid)
172171
void SoftReset(uint32_t homeid)

‎src-lib/libopenzwave/node.pxd‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ along with python-openzwave. If not, see http://www.gnu.org/licenses.
1717
1818
"""
1919
from libc.stdint cimport uint32_t, uint64_t, int32_t, int16_t, uint8_t, int8_t
20-
from mylibc cimport string
2120
from libcpp.vector cimport vector
21+
from mylibc cimport string
2222

2323
cdef extern from "Node.h" namespace "OpenZWave::Node":
2424

@@ -55,4 +55,4 @@ cdef extern from "Node.h" namespace "OpenZWave::Node":
5555
vector[CommandClassData] m_ccData # List of statistic on each command_class
5656

5757
ctypedef NodeData NodeData_t
58-
58+

‎src-lib/libopenzwave/notification.pxd‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ along with python-openzwave. If not, see http://www.gnu.org/licenses.
1717
1818
"""
1919
from libc.stdint cimport uint32_t, uint64_t, int32_t, int16_t, uint8_t, int8_t
20-
from mylibc cimport string
2120
from libcpp cimport bool
2221
from values cimport ValueID
22+
from mylibc cimport string
2323

2424
cdef extern from *:
2525
ctypedef char* const_notification "OpenZWave::Notification const*"

0 commit comments

Comments
 (0)