Skip to content

Commit 34e63e4

Browse files
author
Zoltan Varga
committed
Reorganize release folders. Add Linux pip creation
1 parent d362be2 commit 34e63e4

File tree

10 files changed

+208
-12
lines changed

10 files changed

+208
-12
lines changed

build_all/linux/release.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
# Copyright (c) Microsoft. All rights reserved.
3+
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
5+
build_root=$(cd "$(dirname "$0")/../.." && pwd)
6+
build_folder=$build_root"/c/cmake/iotsdk_linux"
7+
8+
cd $build_root
9+
10+
PYTHON_VERSION=2.7
11+
12+
process_args()
13+
{
14+
save_next_arg=0
15+
16+
for arg in $*
17+
do
18+
if [ $save_next_arg == 1 ]
19+
then
20+
PYTHON_VERSION="$arg"
21+
save_next_arg=0
22+
else
23+
case "$arg" in
24+
"--build-python" ) save_next_arg=1;;
25+
* ) ;;
26+
esac
27+
fi
28+
done
29+
}
30+
31+
process_args $*
32+
33+
# instruct C builder to include python library and to skip tests
34+
./c/build_all/linux/build.sh --build-python $PYTHON_VERSION $*
35+
[ $? -eq 0 ] || exit $?
36+
cd $build_root
37+
38+
echo copy iothub_client library to samples folder
39+
cp $build_folder/python/src/iothub_client.so ./device/samples/iothub_client.so
40+
echo copy iothub_client_mock library to tests folder
41+
cp $build_folder/python/test/iothub_client_mock.so ./device/tests/iothub_client_mock.so
42+
43+
echo copy iothub_service_client library to samples folder
44+
cp $build_folder/python_service_client/src/iothub_service_client.so ./service/samples/iothub_service_client.so
45+
echo copy iothub_service_client_mock library to tests folder
46+
cp $build_folder/python_service_client/tests/iothub_service_client_mock.so ./service/tests/iothub_service_client_mock.so
47+
48+
cd $build_root/device/tests/
49+
echo "python${PYTHON_VERSION}" iothub_client_ut.py
50+
"python${PYTHON_VERSION}" iothub_client_ut.py
51+
[ $? -eq 0 ] || exit $?
52+
echo "python${PYTHON_VERSION}" iothub_client_map_test.py
53+
"python${PYTHON_VERSION}" iothub_client_map_test.py
54+
[ $? -eq 0 ] || exit $?
55+
cd $build_root
56+
57+
cd $build_root/service/tests/
58+
echo "python${PYTHON_VERSION}" iothub_service_client_ut.py
59+
"python${PYTHON_VERSION}" iothub_service_client_ut.py
60+
[ $? -eq 0 ] || exit $?
61+
echo "python${PYTHON_VERSION}" iothub_service_client_map_test.py
62+
"python${PYTHON_VERSION}" iothub_service_client_map_test.py
63+
[ $? -eq 0 ] || exit $?
64+
cd $build_root
65+
66+
cd ./build_all/linux/release_device_client
67+
cp $build_folder/python/src/iothub_client.so iothub_client/iothub_client.so
68+
"python${PYTHON_VERSION}" setup_device_client.py bdist_wheel
69+
cd $build_root
70+
71+
cd ./build_all/linux/release_service_client
72+
cp $build_folder/python_service_client/src/iothub_service_client.so iothub_service_client/iothub_service_client.so
73+
"python${PYTHON_VERSION}" setup_service_client.py bdist_wheel
74+
75+
cd $build_root
File renamed without changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from setuptools import setup, Distribution
2+
import sys
3+
4+
class PlatformError(Exception):
5+
def __init__(self, value):
6+
self.value = value
7+
def __str__(self):
8+
return repr(self.value)
9+
10+
class BinaryDistribution(Distribution):
11+
def is_pure(self):
12+
return False
13+
14+
_long_description=()
15+
16+
try:
17+
if sys.version_info < (2, 7):
18+
raise PlatformError("Require Python 2.7 or greater")
19+
if sys.version_info >= (3, 0) and sys.version_info < (3, 4):
20+
raise PlatformError("Require Python 3.4 or greater")
21+
except PlatformError as e:
22+
sys.exit(e.value)
23+
24+
try:
25+
from iothub_client import iothub_client
26+
_version = iothub_client.__version__
27+
except Exception as e:
28+
sys.exit(e)
29+
30+
setup(
31+
name='azure_iothub_device_client',
32+
version=_version+'.0', # using version of actual c client release
33+
description='IoT Hub Device Client Library',
34+
license='Apache Software License',
35+
url='https://github.com/Azure/azure-iot-sdk-python/tree/master/python/device',
36+
author='aziotclb',
37+
author_email='[email protected]',
38+
long_description='IoT Hub Device Client Library for Python 2.7 and 3.6 - iothub_client.so',
39+
packages=['iothub_client'],
40+
classifiers=[
41+
'Environment :: Linux',
42+
'Development Status :: 3 - Alpha',
43+
'Intended Audience :: Developers',
44+
'Topic :: Software Development :: Build Tools',
45+
'License :: OSI Approved :: Apache Software License',
46+
'Programming Language :: Python :: 2',
47+
'Programming Language :: Python :: 2.7',
48+
'Programming Language :: Python :: 3',
49+
'Programming Language :: Python :: 3.4',
50+
'Programming Language :: Python :: 3.5',
51+
'Programming Language :: Python :: 3.6'],
52+
package_data={
53+
'iothub_client': ['__init__.py','iothub_client.so'],
54+
},
55+
distclass=BinaryDistribution
56+
)

build_all/windows/iothub_service_client/__init__.py renamed to build_all/linux/release_service_client/iothub_service_client/__init__.py

File renamed without changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from setuptools import setup, Distribution
2+
import sys
3+
4+
class PlatformError(Exception):
5+
def __init__(self, value):
6+
self.value = value
7+
def __str__(self):
8+
return repr(self.value)
9+
10+
class BinaryDistribution(Distribution):
11+
def is_pure(self):
12+
return False
13+
14+
_long_description=()
15+
16+
try:
17+
if sys.version_info < (2, 7):
18+
raise PlatformError("Require Python 2.7 or greater")
19+
if sys.version_info >= (3, 0) and sys.version_info < (3, 4):
20+
raise PlatformError("Require Python 3.4 or greater")
21+
except PlatformError as e:
22+
sys.exit(e.value)
23+
24+
try:
25+
from iothub_service_client import iothub_service_client
26+
_version = iothub_service_client.__version__
27+
except Exception as e:
28+
sys.exit(e)
29+
30+
setup(
31+
name='azure_iothub_service_client',
32+
version=_version+'.0', # using version of actual c client release
33+
description='IoT Hub Service Client Library',
34+
license='Apache Software License',
35+
url='https://github.com/Azure/azure-iot-sdk-python/tree/master/python/service',
36+
author='aziotclb',
37+
author_email='[email protected]',
38+
long_description='IoT Hub Service Client Library for Python 2.7 and 3.6 - iothub_service_client.so',
39+
packages=['iothub_service_client'],
40+
classifiers=[
41+
'Environment :: Linux',
42+
'Development Status :: 3 - Alpha',
43+
'Intended Audience :: Developers',
44+
'Topic :: Software Development :: Build Tools',
45+
'License :: OSI Approved :: Apache Software License',
46+
'Programming Language :: Python :: 2',
47+
'Programming Language :: Python :: 2.7',
48+
'Programming Language :: Python :: 3',
49+
'Programming Language :: Python :: 3.4',
50+
'Programming Language :: Python :: 3.5',
51+
'Programming Language :: Python :: 3.6'],
52+
package_data={
53+
'iothub_service_client': ['__init__.py','iothub_service_client.so'],
54+
},
55+
distclass=BinaryDistribution
56+
)

build_all/windows/build_client.cmd

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,31 +134,36 @@ if "%build-platform%"=="x64" (
134134
)
135135

136136
if %wheel%==1 (
137+
cd %build-root%
138+
137139
echo Copy iothub_client.pyd to %build-root%\build_all\windows\iothub_client for IoTHub Device Client Python wheel generation
138-
copy %USERPROFILE%\%cmake-output%\python\src\%build-config%\iothub_client.pyd ..\..\build_all\windows\iothub_client
140+
copy %USERPROFILE%\%cmake-output%\python\src\%build-config%\iothub_client.pyd ..\..\build_all\windows\release_device_client\iothub_client
139141
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
140-
cd %build-root%\build_all\windows
141142
echo update Python packages
142143
python -m pip install -U pip setuptools wheel twine
143-
echo create Python wheel:
144-
echo "python setup.py bdist_wheel --plat-name %platname%"
145-
python setup.py bdist_wheel --plat-name "%platname%"
144+
echo create Python wheel:
145+
echo "python setup_device_client.py bdist_wheel --plat-name %platname%"
146+
cd release_device_client
147+
python setup_device_client.py bdist_wheel --plat-name "%platname%"
146148
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
147149
dir dist
148150
echo IoTHub Device Client Python wheel done
149151

152+
cd %build-root%
150153
echo Copy iothub_service_client.pyd to %build-root%\build_all\windows\iothub_service_client for IoTHub Service Client Python wheel generation
151-
copy %USERPROFILE%\%cmake-output%\python_service_client\src\%build-config%\iothub_service_client.pyd ..\..\build_all\windows\iothub_service_client
154+
copy %USERPROFILE%\%cmake-output%\python_service_client\src\%build-config%\iothub_service_client.pyd ..\..\build_all\windows\release_service_client\iothub_service_client
152155
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
153-
cd %build-root%\build_all\windows
154156
echo update Python packages
155157
python -m pip install -U pip setuptools wheel twine
156158
echo create Python wheel:
157-
echo "python setup.py bdist_wheel --plat-name %platname%"
159+
echo "python setup_service_client.py bdist_wheel --plat-name %platname%"
160+
cd release_service_client
158161
python setup_service_client.py bdist_wheel --plat-name "%platname%"
159162
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
160163
dir dist
161164
echo IoTHub Service Client Python wheel done
165+
166+
cd %build-root%
162167
)
163168
goto :eof
164169

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .iothub_client import *

build_all/windows/setup.py renamed to build_all/windows/release_device_client/setup_device_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def is_pure(self):
3535
url='https://github.com/Azure/azure-iot-sdk-python/tree/master/python/device',
3636
author='aziotclb',
3737
author_email='[email protected]',
38-
long_description='IoT Hub Device Client Library for Python 2.7 and 3.4 - iothub_client.pyd',
38+
long_description='IoT Hub Device Client Library for Python 2.7 and 3.6 - iothub_client.pyd',
3939
packages=['iothub_client'],
4040
classifiers=[
4141
'Environment :: Win32 (MS Windows)',
@@ -47,7 +47,8 @@ def is_pure(self):
4747
'Programming Language :: Python :: 2.7',
4848
'Programming Language :: Python :: 3',
4949
'Programming Language :: Python :: 3.4',
50-
'Programming Language :: Python :: 3.5'],
50+
'Programming Language :: Python :: 3.5',
51+
'Programming Language :: Python :: 3.6'],
5152
package_data={
5253
'iothub_client': ['__init__.py','iothub_client.pyd'],
5354
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .iothub_service_client import *

build_all/windows/setup_service_client.py renamed to build_all/windows/release_service_client/setup_service_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def is_pure(self):
3535
url='https://github.com/Azure/azure-iot-sdk-python/tree/master/python/service',
3636
author='aziotclb',
3737
author_email='[email protected]',
38-
long_description='IoT Hub Service Client Library for Python 2.7 and 3.4 - iothub_service_client.pyd',
38+
long_description='IoT Hub Service Client Library for Python 2.7 and 3.6 - iothub_service_client.pyd',
3939
packages=['iothub_service_client'],
4040
classifiers=[
4141
'Environment :: Win32 (MS Windows)',
@@ -47,7 +47,8 @@ def is_pure(self):
4747
'Programming Language :: Python :: 2.7',
4848
'Programming Language :: Python :: 3',
4949
'Programming Language :: Python :: 3.4',
50-
'Programming Language :: Python :: 3.5'],
50+
'Programming Language :: Python :: 3.5',
51+
'Programming Language :: Python :: 3.6'],
5152
package_data={
5253
'iothub_service_client': ['__init__.py','iothub_service_client.pyd'],
5354
},

0 commit comments

Comments
 (0)