Skip to content

Update SLICOT to 5.7 with BSD license #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 14 additions & 3 deletions .github/workflows/slycot-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,31 @@ jobs:

build-setup:
# Super fast sniff build. If this fails, don't start the other jobs
name: Build setup.py on Ubuntu
name: Build sdist on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout Slycot
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up Python
uses: actions/setup-python@v2
- name: Setup Ubuntu
run: |
sudo apt-get -y install gfortran cmake --fix-missing
sudo apt-get -y install libblas-dev liblapack-dev
pip install scikit-build numpy scipy pytest
- name: Install Slycot
run: python setup.py install
- name: Create Slycot sdist
run: python setup.py sdist

- name: Install Slycot sdist
run: |
mkdir cleancwd
cd cleancwd
tar xfz ../dist/slycot-*.tar.gz
cd slycot-*
python setup.py install
- name: Run tests
run: pytest

Expand Down Expand Up @@ -71,6 +80,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -139,6 +149,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "slycot/src/SLICOT-Reference"]
path = slycot/src/SLICOT-Reference
url = https://github.com/python-control/SLICOT-Reference
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ include slycot/*.py
include slycot/version.py.in
include slycot/src/*.f
include slycot/tests/*.py

graft slycot/src/SLICOT-Reference
69 changes: 59 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ from the conda-forge channel with the following command::

conda install -c conda-forge slycot


Compiling from source
---------------------

Expand All @@ -77,12 +78,53 @@ the correct header files are installed, and specify the environment variable

.. _BLA_VENDOR: https://cmake.org/cmake/help/latest/module/FindBLAS.html#input-variables

Getting the full source code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From source without conda (Linux, macOS, Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get it from PyPI
^^^^^^^^^^^^^^^^

Get the source code of the latest release is available from `PyPI`_. It
contains both the Python to Fortran wrappers as well as the SLICOT-Reference
Fortran sources.

.. _PyPI: https://pypi.org/project/slycot

Get it from GitHub archives
^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you decide to download a source code archive from GitHub (tagged release or
a specific branch), you also have to get the correct version of our
SLICOT-Reference fork and place it into ``slycot/src/SLICOT-Reference``:

1. Download and unpack https://github.com/python-control/Slycot/archive/master.zip
2. Go to https://github.com/python-control/Slycot/master/slycot/src
3. Follow the link of ``SLICOT-Reference @ <commit-id>``
4. Download the archive of SLICOT-Reference from the Code download button
(``https://github.com/python-control/SLICOT-Reference/archive/<commit-id>.zip``)
5. Unpack the contents of the SLICOT-Reference archive into
``slycot/src/SLICOT-Reference``

Replace ``master`` with the release tag or branch name, which you want to build.

Clone the git repository
^^^^^^^^^^^^^^^^^^^^^^^^

Directly checkout the submodule, when cloning the git repository::

Unpack the source code (or clone the git repository) to a directory of your choice,
e.g. ``/path/to/slycot_src/``
git clone --recurse-submodules https://github.com/python-control/Slycot.git

or if you forked the repository::

git clone --recurse-submodules https://github.com/<your-username>/Slycot.git

If you already have a local checkout, but still need to init the submodule::

git submodule init
git submodule update

Compiling with setuptools (Linux, macOS, Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you need to specify a specific compiler, set the environment variable FC
before running the install::
Expand All @@ -98,8 +140,8 @@ To build and install, execute::
cd /path/to/slycot_src/
python setup.py install

From source using the conda recipe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using the conda recipe
~~~~~~~~~~~~~~~~~~~~~~

You can use conda to compile and install Slycot from source. The recipe is
located in the folder ``conda-recipe`` and is intended to work for all
Expand Down Expand Up @@ -127,8 +169,8 @@ To build and install::
conda build -c conda-forge conda-recipe
conda install -c conda-forge --use-local slycot

From source in a conda environment (Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With setuptools in a conda environment (Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A similar method can be used for Linux and macOS, but is detailed here
for Windows. This method uses conda and conda-forge to get most build
Expand Down Expand Up @@ -164,8 +206,6 @@ will download the latest release of the source code from `PyPI`_, compile, and
install Slycot into the currently configured location (virtual environment or
user site-packages).

.. _PyPI: https://pypi.org/project/slycot

Additional hints
~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -194,3 +234,12 @@ Importing ``slycot`` or running ``pytest`` without ``--pyargs slycot`` from
inside the source directory will fail, unless the compiled wrapper library has
been installed into that directory. Note that the ``[tool:pytest]`` section
in ``setup.cfg`` enforces the ``--pyargs slycot`` argument by default.

License
-------
Up until version 0.4, Slycot used a version of SLICOT that was released under
the GPLv2 license. This requires Slycot to be released under the same license. In
December 2020, SLICOT 5.7 was released under BSD-3-Clause. However, as the
existing Slycot wrappers have been submitted by many contributors, we cannot
move away from GPLv2 unless we get the permission to do so by all authors.
Thus, Slycot remains licensed under GPLv2 until further notice.
29 changes: 28 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,33 @@ def get_version_info(srcdir=None):

return FULLVERSION, GIT_REVISION


def check_submodules():
""" verify that the submodules are checked out and clean
use `git submodule update --init`; on failure
"""
if not os.path.exists('.git'):
return
with open('.gitmodules') as f:
for l in f:
if 'path' in l:
p = l.split('=')[-1].strip()
if not os.path.exists(p):
raise ValueError('Submodule %s missing' % p)

proc = subprocess.Popen(['git', 'submodule', 'status'],
stdout=subprocess.PIPE)
status, _ = proc.communicate()
status = status.decode("ascii", "replace")
for line in status.splitlines():
if line.startswith('-') or line.startswith('+'):
raise ValueError('Submodule not clean: %s' % line)


class sdist_checked(sdist):
""" check submodules on sdist to prevent incomplete tarballs """
def run(self):
check_submodules()
sdist.run(self)

def setup_package():
src_path = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -210,6 +236,7 @@ def setup_package():
license='GPL-2.0',
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
cmdclass={"sdist": sdist_checked},
cmake_args=['-DSLYCOT_VERSION:STRING=' + VERSION,
'-DGIT_REVISION:STRING=' + gitrevision,
'-DISRELEASE:STRING=' + str(ISRELEASED),
Expand Down
Loading