[segyio] 294/376: Generate setup.py from cmake

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit c9726be1c6203c6e789f947f644259df55403ffb
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Wed May 3 10:19:40 2017 +0200

    Generate setup.py from cmake
    
    The cmake-generated makefile now outputs a setup.py that is capable of
    building segyio, which is useful for automated building and distribution
    of source and binary packages via pypi or similar.
    
    Additionally, this introduces the concept of a single authorative
    version number, set in the makefile, for the package.
---
 CMakeLists.txt        |  5 ++++
 lib/CMakeLists.txt    |  4 +--
 python/CMakeLists.txt | 23 ++++++++++-----
 python/setup.py.in    | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e069da..7f4e531 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,11 @@
 cmake_minimum_required(VERSION 2.8.11)
 project(segyio)
 
+set(segyio_MAJOR 1)
+set(segyio_MINOR 0)
+set(segyio_PATCH 9b4)
+set(segyio_VERSION ${segyio_MAJOR}.${segyio_MINOR}.${segyio_PATCH})
+
 if (POLICY CMP0042)
     cmake_policy(SET CMP0042 NEW)
 endif ()
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index ad399ed..ba06553 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -26,7 +26,7 @@ target_include_directories(
     segyio-static PUBLIC
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
     $<INSTALL_INTERFACE:include>
-    PRIVATE src)
+    PRIVATE src include)
 
 #
 # dynamic build
@@ -40,7 +40,7 @@ target_include_directories(
     segyio-shared PUBLIC
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
     $<INSTALL_INTERFACE:include>
-    PRIVATE src)
+    PRIVATE src include)
 
 if (BUILD_SHARED_LIBS)
     add_library(segyio ALIAS segyio-shared)
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index d5a569f..2e43a99 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -4,8 +4,8 @@ if (NOT BUILD_PYTHON)
     return()
 endif()
 
-find_package(PythonInterp REQUIRED)
-find_package(PythonLibs REQUIRED)
+find_package(PythonInterp)
+find_package(PythonLibs)
 include(FindPythonModule)
 include(PythonPackage)
 
@@ -29,17 +29,20 @@ if (NOT PYTHONLIBS_FOUND)
     return()
 endif()
 
-if (NOT MSVC)
-    set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
-endif()
-
 add_library(_segyio MODULE segyio/_segyio.c)
+target_link_libraries(_segyio PUBLIC segyio ${PYTHON_LIBRARIES})
 target_include_directories(_segyio PRIVATE ${PYTHON_INCLUDE_DIRS})
-target_link_libraries(_segyio segyio ${PYTHON_LIBRARIES})
 export(TARGETS _segyio segyio-shared segyio-static APPEND FILE segyio-config.cmake)
 
+if(NOT MSVC)
+    target_compile_options(_segyio PUBLIC "-std=c99")
+endif ()
+
 add_python_package(pysegyio segyio
                     TARGETS _segyio
+                    DEPEND_DIRS segyio ${CMAKE_SOURCE_DIR}/lib
+                    VERSION ${segyio_VERSION}
+                    VERSION__INIT__
                     SOURCES segyio/__init__.py
                             segyio/_header.py
                             segyio/_gather.py
@@ -57,6 +60,12 @@ add_python_package(pysegyio segyio
                             segyio/segysampleformat.py
                             segyio/tracesortingformat.py)
 
+add_setup_py(pysegyio setup.py.in)
+
+# Add license & readme to the pip distribution
+configure_file(${CMAKE_SOURCE_DIR}/License.md License)
+configure_file(${CMAKE_SOURCE_DIR}/README.md README)
+
 file(GLOB sgys "${CMAKE_SOURCE_DIR}/test-data/*.sgy")
 foreach (sgy ${sgys})
     get_filename_component(fl ${sgy} NAME)
diff --git a/python/setup.py.in b/python/setup.py.in
new file mode 100644
index 0000000..5a426b4
--- /dev/null
+++ b/python/setup.py.in
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+from setuptools import setup, Extension
+
+long_description = """
+=======
+SEGY IO
+=======
+
+Introduction
+------------
+
+Segyio is a small LGPL licensed C library for easy interaction with SEG Y
+formatted seismic data, with language bindings for Python and Matlab. Segyio is
+an attempt to create an easy-to-use, embeddable, community-oriented library for
+seismic applications. Features are added as they are needed; suggestions and
+contributions of all kinds are very welcome.
+
+Feature summary
+---------------
+ * A low-level C interface with few assumptions; easy to bind to other
+   languages.
+ * Read and write binary and textual headers.
+ * Read and write traces, trace headers.
+ * Easy to use and native-feeling python interface with numpy integration.
+
+Project goals
+-------------
+
+Segyio does necessarily attempt to be the end-all of SEG-Y interactions;
+rather, we aim to lower the barrier to interacting with SEG-Y files for
+embedding, new applications or free-standing programs.
+
+Additionally, the aim is not to support the full standard or all exotic (but
+correctly) formatted files out there. Some assumptions are made, such as:
+
+ * All traces in a file are assumed to be of the same sample size.
+ * It is assumed all lines have the same number of traces.
+
+The writing functionality in Segyio is largely meant to *modify* or adapt
+files. A file created from scratch is not necessarily a to-spec SEG-Y file, as
+we only necessarily write the header fields segyio needs to make sense of the
+geometry. It is still highly recommended that SEG-Y files are maintained and
+written according to specification, but segyio does not mandate this.
+
+"""
+
+setup(name='${PYCMAKE_PACKAGE_NAME}',
+      version='${PYCMAKE_VERSION}',
+      description='Simple & fast IO for SEG-Y files',
+      long_description=long_description,
+      author='Statoil ASA',
+      author_email='ert at statoil.com',
+      url='https://github.com/Statoil/segyio',
+      packages=['segyio'],
+      package_data={'': ['License', 'README']},
+      license='LGPL-3.0',
+      ext_modules=[${PYCMAKE_EXTENSIONS}],
+      platforms='any',
+      requires=['numpy'],
+      install_requires=['numpy'],
+      classifiers=[
+          'Development Status :: 5 - Production/Stable',
+          'Environment :: Other Environment',
+          'Intended Audience :: Developers',
+          'Intended Audience :: Science/Research',
+          'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)',
+          'Natural Language :: English',
+          'Programming Language :: Python',
+          'Programming Language :: Python :: 2.7',
+          'Programming Language :: Python :: 3.5',
+          'Programming Language :: Python :: 3.6',
+          'Topic :: Scientific/Engineering',
+          'Topic :: Scientific/Engineering :: Physics',
+          'Topic :: Software Development :: Libraries',
+          'Topic :: Utilities'
+      ]
+      )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list