Skip to content

Commit bc0f1f5

Browse files
Thijs Miedemaeboasson
Thijs Miedema
authored andcommitted
Single-package with IDL in wheel
1 parent b45c009 commit bc0f1f5

File tree

120 files changed

+1609
-4014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1609
-4014
lines changed

.azure/templates/build-cyclone.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
steps:
1818
- bash: |
19-
git clone https://github.com/eclipse-cyclonedds/cyclonedds.git
19+
git clone https://github.com/eclipse-cyclonedds/cyclonedds.git cyclonedds_c
2020
name: clone_cyclone
2121
displayName: Clone the CycloneDDS repository
2222
- bash: |
@@ -26,7 +26,7 @@ steps:
2626
displayName: Check the build type.
2727
- task: Cache@2
2828
inputs:
29-
key: cyclonedds_build | 4 | $(Agent.OS) | $(build_type) | cyclonedds/.git/refs/heads/master
29+
key: cyclonedds_build | 4 | $(Agent.OS) | $(build_type) | cyclonedds_c/.git/refs/heads/master
3030
path: cyclone-$(Agent.OS)-$(build_type)
3131
cacheHitVar: CACHE_RESTORED
3232
name: cyclonedds_cache
@@ -52,8 +52,8 @@ steps:
5252
displayName: Setup for Windows builds
5353
- bash: |
5454
set -e -x
55-
mkdir -p cyclonedds/build cyclone-$(Agent.OS)-$(build_type)
56-
cd cyclonedds/build
55+
mkdir -p cyclonedds_c/build cyclone-$(Agent.OS)-$(build_type)
56+
cd cyclonedds_c/build
5757
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
5858
-DCMAKE_INSTALL_PREFIX=../../cyclone-$(Agent.OS)-$(build_type) \
5959
-DENABLE_LIFESPAN=ON \

.azure/templates/build-test.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,21 @@ steps:
3434
set -e -x
3535
pip install --user --upgrade pip
3636
pip install --user --upgrade pytest pytest-azurepipelines pytest-cov pytest-mock flake8
37-
pip install --user ./src/pycdr
38-
pip install --user ./src/cyclonedds
37+
pip install --user .
3938
name: install_cyclonedds_py
4039
displayName: Run installers
4140
env:
4241
cflags: -Werror
4342
- bash: |
44-
python -m flake8 ./src/pycdr/pycdr --count --select=E9,F63,F7,F82 --show-source --statistics
45-
python -m flake8 ./src/cyclonedds/cyclonedds --count --select=E9,F63,F7,F82 --show-source --statistics
46-
python -m flake8 ./src/pycdr/pycdr --count --exit-zero --max-complexity=10 --max-line-length=127 --per-file-ignores="__init__.py:F401" --statistics
47-
python -m flake8 ./src/cyclonedds/cyclonedds --count --exit-zero --max-complexity=10 --max-line-length=127 --per-file-ignores="__init__.py:F401" --statistics
43+
python -m flake8 ./cyclonedds --count --select=E9,F63,F7,F82 --show-source --statistics
44+
python -m flake8 ./cyclonedds --count --exit-zero --max-complexity=10 --max-line-length=127 --per-file-ignores="__init__.py:F401" --statistics
4845
name: flake8_lint
4946
displayName: Run Flake8 Linter
5047
- bash: |
51-
python -m pytest ./src/pycdr -v --no-coverage-upload
52-
name: test_pycdr
53-
displayName: Run tests for PyCDR
54-
- bash: |
55-
python -m pytest ./src/cyclonedds -v --no-coverage-upload
48+
cd tests
49+
python -m pytest .. -v --no-coverage-upload
5650
name: test_cyclonedds_py
5751
displayName: Run tests for CycloneDDS
58-
- bash: |
59-
python -m coverage combine src/cyclonedds/.coverage src/pycdr/.coverage
60-
python -m coverage xml
61-
name: collect_test_coverage
62-
displayName: Collect PyCDR and CycloneDDS coverage data
63-
- task: PublishCodeCoverageResults@1
64-
displayName: Publish Cobertura Coverage Report
65-
inputs:
66-
codeCoverageTool: Cobertura
67-
summaryFileLocation: coverage.xml
52+
- publish: tests/.coverage
53+
artifact: coverage-$(Agent.JobName)
54+
displayName: Publish coverage artifact

.azure/templates/build-wheel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ steps:
2424
displayName: Install dependencies
2525
- bash: |
2626
set -x -e
27-
python -m cibuildwheel --output-dir wheelhouse ./src/cyclonedds
27+
python -m cibuildwheel --output-dir wheelhouse .
2828
displayName: Build wheels (Linux/Macos)
2929
condition: ne(variables['Agent.OS'], 'Windows_NT')
3030
- pwsh: |
31-
python -m cibuildwheel --output-dir wheelhouse ./src/cyclonedds
31+
python -m cibuildwheel --output-dir wheelhouse .
3232
displayName: Build wheels (Windows)
3333
condition: eq(variables['Agent.OS'], 'Windows_NT')
3434
- publish: wheelhouse

.azure/templates/publish-package.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ steps:
2626
name: install_twine
2727
displayName: Install Twine
2828
- bash: |
29-
cd ./src/pycdr
30-
python setup.py sdist
31-
name: build_pycdr_src_dist
32-
displayName: Build PyCDR source distribution
33-
- bash: |
34-
cd ./src/cyclonedds
3529
python setup.py sdist
3630
name: build_cyclonedds_src_dist
3731
displayName: Build CycloneDDS source distribution
@@ -40,12 +34,6 @@ steps:
4034
inputs:
4135
secureFile: pypi_credentials
4236
- bash: |
43-
cd ./src/pycdr
44-
python -m twine upload -r $(PYPI_REPOSITORY) --config-file $(pypi_credentials.secureFilePath) --skip-existing dist/*
45-
name: publish_pycdr
46-
displayName: Publish PyCDR
47-
- bash: |
48-
cd ./src/cyclonedds
4937
python -m twine upload -r $(PYPI_REPOSITORY) --config-file $(pypi_credentials.secureFilePath) --skip-existing dist/*
5038
name: publish_cyclonedds
5139
displayName: Publish CycloneDDS
File renamed without changes.

.gitignore

Lines changed: 135 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,138 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
111
build/
2-
build-windows/
3-
**/build
4-
.vscode/*
5-
__pycache__
6-
docs/_build
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
743
.coverage
8-
.env
9-
cov.xml
44+
.coverage.*
45+
.cache
46+
nosetests.xml
1047
coverage.xml
11-
*.egg-info
12-
.inputrc
13-
.python-version
14-
snippets.txt
15-
src/cyclonedds/dist/
16-
src/pycdr/dist/
17-
cdds-activate
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.18)
22
# CMAKE_PREFIX_PATH environment variable is available in CMake >= 3.18
3-
project(_clayer LANGUAGES C)
3+
project(clayer LANGUAGES C)
44
find_package(PythonExtensions REQUIRED)
55
find_package(CycloneDDS REQUIRED)
66

@@ -11,15 +11,21 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
1111
-Winfinite-recursion -Wassign-enum -Wcomma -Wshadow
1212
-Wstrict-prototypes -Wconditional-uninitialized)
1313
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
14-
add_compile_options(-Wall -Wextra -Wconversion -Wmissing-prototypes)
14+
add_compile_options(-Wall -Wextra -Wconversion -Wmissing-prototypes -Wpedantic --pedantic-errors)
1515
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
1616
add_compile_options(/W3)
1717
endif()
1818

19-
add_library(_clayer MODULE clayer/src/cdrkeyvm.c clayer/src/pysertype.c)
19+
# Build python c layer
20+
add_library(_clayer MODULE clayer/cdrkeyvm.c clayer/pysertype.c)
2021
target_link_libraries(_clayer CycloneDDS::ddsc)
2122
python_extension_module(_clayer)
2223
install(
2324
TARGETS _clayer
24-
LIBRARY DESTINATION cyclonedds
25-
RUNTIME DESTINATION cyclonedds)
25+
LIBRARY DESTINATION cyclonedds)
26+
27+
28+
# Build idl python backend
29+
if (TARGET CycloneDDS::idl)
30+
add_subdirectory(idlpy)
31+
endif()

README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ You can either install the source from the latest release from pypi:
3535

3636
or you can download the code from this repository to get the bleeding edge and directly install from your local filesystem:
3737

38-
$ git clone https://github.com/eclipse-cyclonedds/cyclonedds-python
39-
$ cd cyclonedds-python
4038
$ export CYCLONEDDS_HOME="/path/to/cyclone"
41-
$ pip install ./src/pycdr
42-
$ pip install ./src/cyclonedds
39+
$ pip install https://github.com/eclipse-cyclonedds/cyclonedds-python
4340

4441
If you get permission errors you are using your system python. This is not recommended, we recommend using [a virtual environment][2], [poetry][3], [pipenv][4] or [pyenv][5]. If you _just_ want to get going, you can add `--user` to your pip command to install for the current user. See the [Installing Python Modules][6] Python documentation.
4542

@@ -51,19 +48,6 @@ If you get permission errors you are using your system python. This is not recom
5148
[6]: https://docs.python.org/3/installing/index.html
5249

5350

54-
# Installing the Python backend for the IDL compiler
55-
56-
The code for the Python backend for the IDL compiler is contained in `src/idlpy` and builds like any other cmake project:
57-
58-
$ git clone https://github.com/eclipse-cyclonedds/cyclonedds-python
59-
$ cd cyclonedds-python/src/idlpy
60-
$ mkdir build
61-
$ cmake -DCMAKE_INSTALL_PREFIX=<install-location> \
62-
-DCMAKE_PREFIX_PATH="<cyclonedds-install-location>" \
63-
..
64-
$ cmake --build .
65-
$ cmake --build . --target install
66-
6751
For more details on this process take a look at the [Eclipse Cyclone DDS C++ repository][7] which explains the cmake process in depth.
6852

6953
[7]: https://github.com/eclipse-cyclonedds/cyclonedds-cxx/

azure-pipelines.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ jobs:
5656
'macOS 10.15 with Python 3.9':
5757
image: macOS-10.15
5858
python-version: 3.9
59+
'Windows Server 2019 with Python 3.6':
60+
image: windows-2019
61+
python-version: 3.6
5962
'Windows Server 2019 with Python 3.9':
6063
image: windows-2019
6164
python-version: 3.9
@@ -72,3 +75,25 @@ jobs:
7275
name: set_cyclonedds_home
7376
displayName: Set CYCLONEDDS_HOME
7477
- template: /.azure/templates/build-test.yml
78+
- job: CoverageReport
79+
dependsOn: AutomatedTests
80+
pool:
81+
vmImage: ubuntu-20.04
82+
steps:
83+
- bash: |
84+
mkdir coverage
85+
- task: DownloadPipelineArtifact@2
86+
inputs:
87+
path: coverage
88+
displayName: Download Coverage
89+
- task: UsePythonVersion@0
90+
- bash: |
91+
ls coverage
92+
pip install --user coverage
93+
python -m coverage combine ./coverage/*/.coverage
94+
python -m coverage xml
95+
- task: PublishCodeCoverageResults@1
96+
displayName: Publish Cobertura Coverage Report
97+
inputs:
98+
codeCoverageTool: Cobertura
99+
summaryFileLocation: coverage.xml
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)