Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
CrysFML
Commits
0d3a99c8
Unverified
Commit
0d3a99c8
authored
Jul 19, 2021
by
Simon Ward
Browse files
Merge branch 'CFML_build_updates' into feature-python_api-build_wheels
parents
b829e2a1
59e1503b
Pipeline
#10461
failed with stages
in 6 minutes and 28 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
.github/workflows/build_variants.yml
View file @
0d3a99c8
# Adapted from https://github.com/RalfG/python-wheels-manylinux-build/blob/master/full_workflow_example.yml
name
:
Build CFML wheels on various systems
name
:
Python libs
on
:
push
:
branches
:
[
simon
]
branches
:
[
master
]
pull_request
:
branches
:
[
master
]
# schedule:
# # Every day at 1am
# - cron: '0 1 * * *'
jobs
:
get_Latest
:
runs-on
:
ubuntu-latest
if
:
"
!contains(github.event.head_commit.message,
'[ci
skip]')"
steps
:
-
name
:
Checkout ILL repo
run
:
|
git clone https://code.ill.fr/scientific-software/crysfml/ ./
git checkout feature-python_api-build_wheels
rm -rf ./.git ./Html
-
uses
:
actions/upload-artifact@v2
with
:
name
:
CrysFML_SRC
path
:
${{ github.workspace }}
retention-days
:
1
create-Linux
:
runs-on
:
ubuntu-latest
needs
:
get_Latest
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/download-artifact@v2
with
:
name
:
CrysFML_SRC
-
name
:
Build manylinux wheels
run
:
docker run -e PLAT=manylinux2010_x86_64 -v `pwd`:/io quay.io/pypa/manylinux2010_x86_64 /io/Scripts/buildscript.sh
run
:
|
chmod +x ./Scripts/buildscript.sh
docker run -e PLAT=manylinux2010_x86_64 -v ${{ github.workspace }}:/io quay.io/pypa/manylinux2010_x86_64 /io/Scripts/buildscript.sh
-
uses
:
actions/upload-artifact@v2
with
:
name
:
CrysFML - Linux
...
...
@@ -24,19 +51,18 @@ jobs:
strategy
:
max-parallel
:
4
matrix
:
python-version
:
[
'
3.
6'
,
'
3.7'
,
'
3.8'
,
'
3.9
'
]
python-version
:
[
'
3.
8
'
]
os
:
[
macos-10.15
]
gcc_v
:
[
10
]
# Version of GFortran we want to use.
# exclude: # Currently only python > 3.8 is supported on macos-11.0 and > 3.6 on macos-10.15
# - os: macos-11.0
# python-version: '3.7'
# - os: macos-11.0
# python-version: '3.8'
runs-on
:
${{ matrix.os }}
needs
:
get_Latest
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/download-artifact@v2
with
:
name
:
CrysFML_SRC
-
name
:
Setup python
uses
:
actions/setup-python@v1
...
...
@@ -53,31 +79,27 @@ jobs:
run
:
|
pip3 wheel ./ --no-deps -w ./old/
delocate-wheel -w dist -v ./old/*.whl
-
uses
:
actions/upload-artifact@v2
with
:
name
:
CrysFML -
${{ matrix.os }} - Python ${{ matrix.python-version }}
name
:
CrysFML -
MacOS
path
:
./dist/*.whl
create-Windows
:
strategy
:
max-parallel
:
4
max-parallel
:
1
matrix
:
python-version
:
[
'
3.6'
,
'
3.7'
]
os
:
[
windows-latest
]
runs-on
:
${{ matrix.os }}
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Setup python
uses
:
actions/setup-python@v1
-
uses
:
conda-incubator/setup-miniconda@v2
with
:
python-version
:
${{matrix.python-version}}
-
name
:
Install wheel
run
:
pip install wheel
auto-update-conda
:
true
python-version
:
${{ matrix.python-version }}
auto-activate-base
:
true
-
uses
:
msys2/setup-msys2@v2
with
:
...
...
@@ -89,31 +111,31 @@ jobs:
-
name
:
Build CFML
shell
:
msys2 {0}
id
:
build
run
:
p
ip wheel ./ --no-deps -w ./dist/
run
:
p
ython setup.py bdist_wheel
env
:
MINGW_ARCH
:
MINGW64
-
uses
:
actions/upload-artifact@v2
with
:
name
:
CrysFML -
${{ matrix.os }} - Python ${{ matrix.python-version }}
name
:
CrysFML -
Windows
path
:
./dist/*.whl
Upload_Artifacts
:
runs-on
:
ubuntu-latest
needs
:
[
create-Linux
,
create-OSX
,
create-Windows
]
needs
:
[
create-Linux
,
create-OSX
]
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/download-artifact@v2
-
name
:
What is downloaded
run
:
|
ls -al
-
name
:
Upload Artifacts GitHub releases
# if: github.event_name == 'push'
uses
:
ncipollo/release-action@v1
with
:
draft
:
fal
a
se
draft
:
false
prerelease
:
true
allowUpdates
:
true
replacesArtifacts
:
true
token
:
${{ secrets.GITHUB_TOKEN }}
artifacts
:
"
./dist/*.whl"
tag
:
${{ env.BRANCH_NAME }}
commit
:
${{ env.BRANCH_NAME }}
bodyFile
:
"
RELEASE.md"
artifacts
:
"
./**/*.whl"
tag
:
"
CurrentBuild"
body
:
"
This
is
a
build
of
the
CFML
libraries."
Scripts/buildscript.sh
View file @
0d3a99c8
...
...
@@ -17,11 +17,11 @@ function repair_wheel {
# Compile wheels
for
PYBIN
in
/opt/python/
*
/bin
;
do
# "${PYBIN}/pip" install -r /io/dev-requirements.txt
"
${
PYBIN
}
/pip"
wheel /io/
--no-deps
--use-feature
=
in
-tree-build
-w
/io/dist/
rm
-rf
/io/build/
done
#
for PYBIN in /opt/python/*/bin; do
export
PYBIN
=
/opt/python/cp38-cp38/bin
"
${
PYBIN
}
/pip"
wheel /io/
--no-deps
--use-feature
=
in
-tree-build
-w
/io/dist/
rm
-rf
/io/build/
#
done
# Bundle external shared libraries into the wheels
for
whl
in
/io/dist/
*
.whl
;
do
...
...
@@ -29,7 +29,6 @@ for whl in /io/dist/*.whl; do
done
# Install packages and test
for
PYBIN
in
/opt/python/
*
/bin/
;
do
"
${
PYBIN
}
/pip"
install
CFML
--no-index
-f
/io/dist
# (cd "$HOME"; "${PYBIN}/nosetests" pymanylinuxdemo)
done
\ No newline at end of file
#for PYBIN in /opt/python/*/bin/; do
"
${
PYBIN
}
/pip"
install
CFML
--no-index
-f
/io/dist
#done
\ No newline at end of file
setup.py
View file @
0d3a99c8
import
os
import
pathlib
import
pkgutil
...
...
@@ -7,6 +8,7 @@ import sys
import
setuptools
import
distutils.sysconfig
as
sysconfig
from
distutils.core
import
setup
import
distutils.command.build
from
distutils.command.install_data
import
install_data
from
subprocess
import
CalledProcessError
,
check_output
,
check_call
...
...
@@ -15,6 +17,23 @@ from setuptools.command.build_ext import build_ext
from
setuptools.command.install_lib
import
install_lib
from
setuptools.command.install_scripts
import
install_scripts
try
:
from
wheel.bdist_wheel
import
bdist_wheel
as
_bdist_wheel
# this overrides standard naming of the wheel to not include
# architecture or python dot version number
class
Bdist_wheel
(
_bdist_wheel
):
def
finalize_options
(
self
):
_bdist_wheel
.
finalize_options
(
self
)
self
.
root_is_pure
=
False
def
get_tag
(
self
):
python
,
abi
,
plat
=
_bdist_wheel
.
get_tag
(
self
)
python
,
abi
=
'py3'
,
'none'
return
python
,
abi
,
plat
except
ImportError
:
Bdist_wheel
=
None
BITS
=
struct
.
calcsize
(
"P"
)
*
8
PACKAGE_NAME
=
"crysfml_api"
SOURCE_DIR
=
'.'
...
...
@@ -42,7 +61,6 @@ def get_cmake():
class
CMakeExtension
(
Extension
):
"""
An extension to run the cmake build
This simply overrides the base extension class so that setuptools
doesn't try to build your sources for you
"""
...
...
@@ -54,7 +72,6 @@ class CMakeExtension(Extension):
class
InstallCMakeLibsData
(
install_data
):
"""
Just a wrapper to get the install data into the egg-info
Listing the installed files in the egg-info guarantees that
all of the package files will be uninstalled when the user
uninstalls your package through pip
...
...
@@ -72,10 +89,10 @@ class InstallCMakeLibsData(install_data):
self
.
outfiles
=
self
.
distribution
.
data_files
class
InstallCMakeLibs
(
install_lib
):
"""
Get the libraries from the parent distribution, use those as the outfiles
Skip building anything; everything is already built, forward libraries to
the installation step
"""
...
...
@@ -141,6 +158,8 @@ class InstallCMakeLibs(install_lib):
super
().
run
()
pass
class
InstallCMakeScripts
(
install_scripts
):
"""
...
...
@@ -192,7 +211,8 @@ class BuildCMakeExt(build_ext):
for
extension
in
self
.
extensions
:
self
.
build_cmake
(
extension
)
super
().
run
()
# super().run()
pass
def
build_cmake
(
self
,
extension
:
Extension
):
"""
...
...
@@ -203,10 +223,17 @@ class BuildCMakeExt(build_ext):
build_dir
=
pathlib
.
Path
(
self
.
build_temp
)
extension_path
=
pathlib
.
Path
(
self
.
get_ext_fullpath
(
extension
.
name
))
# don't store the abi3 info in filename
extension
.
_file_name
=
extension
.
_full_name
ext_path
=
pathlib
.
Path
(
self
.
get_ext_fullpath
(
extension
.
name
))
ext_ext
=
os
.
path
.
splitext
(
ext_path
)[
1
]
filename
=
extension
.
_file_name
+
ext_ext
extension_path
=
os
.
path
.
join
(
ext_path
.
parent
,
filename
)
os
.
makedirs
(
build_dir
,
exist_ok
=
True
)
os
.
makedirs
(
ext
ension
_path
.
parent
.
absolute
(),
exist_ok
=
True
)
os
.
makedirs
(
ext_path
.
parent
.
absolute
(),
exist_ok
=
True
)
# Now that the necessary directories are created, build
...
...
@@ -264,6 +291,16 @@ class BuildCMakeExt(build_ext):
# different place. See comments above for additional information
class
BuildCommand
(
distutils
.
command
.
build
.
build
):
def
initialize_options
(
self
):
# this overrides the directory names for
# build/lib and build/temp
distutils
.
command
.
build
.
build
.
initialize_options
(
self
)
self
.
build_platlib
=
'build/lib'
self
.
build_temp
=
'build/temp'
setup
(
name
=
"CFML"
,
version
=
"0.0.1"
,
author
=
"Simon Ward"
,
...
...
@@ -281,11 +318,14 @@ setup(name="CFML",
"Programming Language :: Fortran"
,
"Programming Language :: Python"
],
license
=
'LGPL'
,
cpython_tags
=
None
,
cmdclass
=
{
'build'
:
BuildCommand
,
'build_ext'
:
BuildCMakeExt
,
'install_data'
:
InstallCMakeLibsData
,
'install_lib'
:
InstallCMakeLibs
,
'install_scripts'
:
InstallCMakeScripts
'install_scripts'
:
InstallCMakeScripts
,
'bdist_wheel'
:
Bdist_wheel
},
setup_requires
=
[
'wheel'
]
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment