-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 15be350
Showing
6 changed files
with
420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: xmsconan | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
flake: | ||
name: Flake Project | ||
runs-on: ${{ matrix.platform }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ubuntu-18.04] | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
# Checkout Sources | ||
- name: Checkout Source | ||
uses: actions/checkout@v2 | ||
# Setup Python | ||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# Install Python Dependencies | ||
- name: Install Python Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 flake8-docstrings flake8-bugbear flake8-import-order pep8-naming | ||
# Flake Code | ||
- name: Run Flake | ||
run: | | ||
flake8 --exclude .tox,.git,__pycache__,_package/tests/files/*,pydocs/source/conf.py,build,dist,tests/fixtures/*,*.pyc,*.egg-info,.cache,.eggs --ignore=D200,D212 --max-line-length=120 --docstring-convention google --isolated --import-order-style=appnexus --application-import-names=xmsconan --application-package-names=xms --count --statistics . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Misc | ||
.*.swp | ||
*.DS_STORE | ||
*~ | ||
*.pyc | ||
.idea/ | ||
build/ | ||
cmake-build-debug/ | ||
cmake-build-release/ | ||
test_package/build/ | ||
*.egg-info/ | ||
|
||
# Doxygen | ||
Doxygen/doxy_warn.log | ||
Doxygen/sphinx_warnings.log | ||
Doxygen/xmscore.tag | ||
Doxygen/html/* | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
*.pyd | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
# build directories | ||
build/* | ||
pybuild/* | ||
build_py/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Setup.py file for the xms.core python package. | ||
""" | ||
from setuptools import setup | ||
|
||
requires = [] | ||
|
||
|
||
version = '0.0.0' | ||
|
||
setup( | ||
python_requires='>=3.10', | ||
name='xmsconan', | ||
version=version, | ||
packages=['xmsconan'], | ||
include_package_data=True, | ||
license='BSD 2-Clause License', | ||
description='', | ||
author='Gage Larsen', | ||
install_requires=requires, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
Methods and Modules used to aid in xmsconan projects. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
""" | ||
A group of functions to aid in conan builds. | ||
""" | ||
import os | ||
|
||
from cpt.packager import ConanMultiPackager | ||
|
||
|
||
def get_builder(library_name): | ||
""" | ||
A function to build a matrix of conan BuildConfig objects. | ||
Args: | ||
library_name (str): The name of the library the conan file is for. | ||
Returns: | ||
List: A list of BuildConfig objects for the conan build. | ||
""" | ||
builder = ConanMultiPackager() | ||
builder.add_common_builds() | ||
|
||
# Add environment variables to build definitions | ||
xms_version = os.getenv('XMS_VERSION', None) | ||
python_target_version = os.getenv('PYTHON_TARGET_VERSION', "3.10") | ||
release_python = os.getenv('RELEASE_PYTHON', 'False') | ||
aquapi_username = os.getenv('AQUAPI_USERNAME', None) | ||
aquapi_password = os.getenv('AQUAPI_PASSWORD', None) | ||
aquapi_url = os.getenv('AQUAPI_URL', None) | ||
|
||
for settings, options, env_vars, _, _ in builder.items: | ||
# General Options | ||
env_vars.update({ | ||
'XMS_VERSION': xms_version, | ||
'PYTHON_TARGET_VERSION': python_target_version, | ||
'RELEASE_PYTHON': release_python, | ||
'AQUAPI_USERNAME': aquapi_username, | ||
'AQUAPI_PASSWORD': aquapi_password, | ||
'AQUAPI_URL': aquapi_url, | ||
}) | ||
|
||
# Require C++ standard compatibility | ||
if settings['compiler'] == 'gcc': | ||
settings.update({ | ||
'compiler.libcxx': 'libstdc++11' | ||
}) | ||
compiler_version = int(settings['compiler.version']) | ||
if compiler_version in [5, 6]: | ||
settings.update({'cppstd': '14'}) | ||
elif compiler_version == 7: | ||
settings.update({'cppstd': '17'}) | ||
elif settings['compiler'] == 'apple-clang': | ||
settings.update({'cppstd': 'gnu17'}) | ||
elif settings['compiler'] == 'Visual Studio': | ||
settings.update({'cppstd': '17'}) | ||
|
||
# These options are mutually exclusive. wchar_t:builtin == True | ||
options.update({ | ||
f'{library_name}:wchar_t': 'builtin', | ||
f'{library_name}:pybind': False, | ||
f'{library_name}:testing': False, | ||
}) | ||
|
||
# wchar_t builders | ||
wchar_t_update_builds = [] | ||
for settings, options, env_vars, build_requires, _ in builder.items: | ||
# wchar_t builds are only built for Visual Studio builds. | ||
if settings['compiler'] == 'Visual Studio': | ||
# Set wchar_t options and add a build configuration | ||
wchar_t_options = dict(options) | ||
wchar_t_options.update({ | ||
f'{library_name}:wchar_t': 'typedef', | ||
}) | ||
wchar_t_update_builds.append([settings, wchar_t_options, env_vars, build_requires]) | ||
|
||
# pybind builders | ||
pybind_updated_builds = [] | ||
for settings, options, env_vars, build_requires, _ in builder.items: | ||
# Pybind builds are built for 64-bit, non-debug MD(d) builds. | ||
if settings['arch'] == 'x86_64' and settings['build_type'] != 'Debug' and \ | ||
(settings['compiler'] != 'Visual Studio' or settings['compiler.runtime'] in ['MD', 'MDd']): | ||
# Pybind is only built for visual studio versions greater than 12. | ||
if settings['compiler'] == 'Visual Studio' and int(settings['compiler.version']) <= 12: | ||
continue | ||
# Update conan options and add a build configuration | ||
pybind_options = dict(options) | ||
pybind_options.update({ | ||
f'{library_name}:pybind': True, | ||
}) | ||
pybind_updated_builds.append([settings, pybind_options, env_vars, build_requires]) | ||
|
||
# testing_builders | ||
testing_update_builds = [] | ||
for settings, options, env_vars, build_requires, _ in builder.items: | ||
# Testing builds are built for each base configuration | ||
testing_options = dict(options) | ||
testing_options.update({ | ||
f'{library_name}:testing': True, | ||
}) | ||
testing_update_builds.append([settings, testing_options, env_vars, build_requires]) | ||
|
||
builder.builds = builder.items + wchar_t_update_builds + pybind_updated_builds + testing_update_builds | ||
|
||
return builder |
Oops, something went wrong.