Skip to content
Snippets Groups Projects
Commit a1f7f5ea authored by Dilawar Singh's avatar Dilawar Singh
Browse files

Squashed 'moose-core/' changes from 49d5b3e..f1dcea8

f1dcea8 Install in debian layout in packages. Added option in setup.cfg file Its delicate solution. Added a note.
5a73acb Finally. Needs to write setup.cfg file to make /usr/local  and /usr prefix consistent.
d7c41e4 bdist_egg is more consistent on both RPM and DEB based systems.
be42fd2 Merge commit 'bcf5c52d' into chennapoda
d27db9c Do not use -p switch. its not easy to get required info from all linux-distributions.
e667953 Fixed message to set in cmake.
8523290 Fixed typo in command.
0b125f6 Fixed typo in cmake file.
f3118f0 multiple fix to build system. - dont use python setup.py install . It does not work anymore if --prefix   directory is not in PYTHONPATH. - Use python setup.py bdist -d INSTALL_DIR and let cmake unarchive and copy it   to desired location. This is much better solution.
03d5899 Use bdist instead of install for creating binay distrution. During installation, untar this to destination.
a08658e Tweaks to setup.cmake.py file.
c5f1d91 Test on travis.
6b32fde Merge commit '6d651b60'
324a20c Merge commit 'e0b8959c'
59f6e9e On debian/ubuntu install-layout option is set to deb. [skip ci]
62201d9 Merge commit 'f80ae40d'
9b81dfc This fixes moose but a better solution to install pymoose in moose-core must be found.
7e27f80 Merge commit '6f7697fb'
939c734 Merge commit '627f1ce1'
4775933 Merge commit '7b3c355a'
43c0674 Squashed 'moose-core/' changes from d4417dcffd..2657e3345e (#222)
8c9ad49 Fixed the syntax causing failure.
397efaf Handling MOOSE_VERSION is better way.

git-subtree-dir: moose-core
git-subtree-split: f1dcea850568ddaabc765771566ab93891ceb312
parent 6d651b60
No related branches found
No related tags found
No related merge requests found
set(CMAKE_LEGACY_CYGWIN_WIN32 0) set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR) cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(moose-core) project(pymoose)
if(COMMAND cmake_policy) if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0003 NEW)
...@@ -29,7 +29,7 @@ endif() ...@@ -29,7 +29,7 @@ endif()
# If from command line, version info is not passed, use the git to generate a # If from command line, version info is not passed, use the git to generate a
# version file. If GIT fails, use the previous known version. # version file. If GIT fails, use the previous known version.
if(NOT VERSION_MOOSE) if(NOT VERSION_MOOSE)
set(VERSION_MOOSE "3.2.0rc1-${GIT_HEAD}") set(VERSION_MOOSE "3.2.0-${GIT_HEAD}")
endif( ) endif( )
add_definitions( -DMOOSE_VERSION="${VERSION_MOOSE}") add_definitions( -DMOOSE_VERSION="${VERSION_MOOSE}")
message( STATUS "MOOSE Version ${VERSION_MOOSE}" ) message( STATUS "MOOSE Version ${VERSION_MOOSE}" )
...@@ -393,6 +393,7 @@ endif() ...@@ -393,6 +393,7 @@ endif()
######################### BUILD PYMOOSE ######################################## ######################### BUILD PYMOOSE ########################################
add_subdirectory( pymoose ) add_subdirectory( pymoose )
######################### INSTALL ############################################## ######################### INSTALL ##############################################
if(DEBUG) if(DEBUG)
...@@ -421,18 +422,25 @@ execute_process( ...@@ -421,18 +422,25 @@ execute_process(
message( STATUS "Platform ${_platform_desc}" ) message( STATUS "Platform ${_platform_desc}" )
set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX}") # DISTUTILS_EXTRA_ARGS may come of top-level cmake script. On DEBIAN/UBUNTU, it
# is most likely to be --install-layout=deb .
set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX} ${DISTUTILS_EXTRA_ARGS}")
# On Debian/Ubuntu install using debian layout # On Debian/Ubuntu install using debian layout.
# NOTE: Also create setup.cfg file which setup prefix and install-layout
# suitable for DEBIAN systems.
if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" ) if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" )
list( APPEND EXTRA_ARGS "--install-layout=deb" ) list( APPEND EXTRA_ARGS "--install-layout=deb" )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg
"[install]\nprefix=/usr\ninstall-layout=deb"
)
endif( ) endif( )
# If make is called with sudo, install in system directories. Otherwise use # If make is called with sudo, install in system directories. Otherwise use
# --user to install in user home. # --user to install in user home.
install(CODE install(CODE
"execute_process( "execute_process(
COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py install ${EXTRA_ARGS} ${PYMOOSE_EXTRA_INSTALL_ARGS} COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py install -f ${EXTRA_ARGS} ${PYMOOSE_EXTRA_INSTALL_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
)" )"
) )
...@@ -447,6 +455,27 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make") ...@@ -447,6 +455,27 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make")
) )
endif() endif()
# Target for creating bdist. This is handy for creating bdist for packaging.
# Save the binary distribution (tar.gz) to PYMOOSE_BDIST_DIR. Note that this
# target is only useful when creating packages on Open Build Service i.e. if you
# use this target on distribution X, it may not work on distrbutions other than
# X. See python-wheels for making portable distributions.
if(NOT PYMOOSE_BDIST_DIR)
set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/pymoose_bdist)
endif( )
# get platform and arch using python.
# NOTE: creating bdist or bdist_dump uses /usr and /usr/local on rpm and deb
# based unix respectively. Not a great situation to be in. Need to write a
# setup.cfg file to fix the prefix in all cases.
find_package( PythonInterp REQUIRED)
add_custom_target( bdist
COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist_dumb -d ${PYMOOSE_BDIST_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
COMMENT "Genearating bdist using setup.cmake.py."
VERBATIM
)
############################ CTEST ###################################### ############################ CTEST ######################################
include( CTest ) include( CTest )
......
...@@ -26,11 +26,12 @@ import logging ...@@ -26,11 +26,12 @@ import logging
from collections import defaultdict from collections import defaultdict
import time import time
logfile_ = tempfile.NamedTemporaryFile( )
logging.basicConfig( logging.basicConfig(
level=logging.DEBUG, level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M', datefmt='%m-%d %H:%M',
filename='tests.log', filename = logfile_.name,
filemode='w' filemode='w'
) )
console = logging.StreamHandler() console = logging.StreamHandler()
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""setup.py: """
Script to install python targets. setup.cmake.py:
NOTE: This script is to be called by CMake. Not intended to be used standalone. Script to install python targets by cmake.
DO NOT USE IT DIRECTLY. Only `cmake` build system should use it directly.
""" """
__author__ = "Dilawar Singh" __author__ = "Dilawar Singh"
...@@ -20,33 +21,30 @@ import os ...@@ -20,33 +21,30 @@ import os
import sys import sys
try: try:
from setuptools import setup from setuptools import setup
except Exception as e: except Exception as e:
from distutils.core import setup from distutils.core import setup
script_dir = os.path.dirname( os.path.abspath( __file__ ) )
version = '3.2pre1'
try: # Read version from VERSION created by cmake file. This file must be present for
with open( os.path.join( script_dir, 'VERSION'), 'r' ) as f: # setup.cmake.py to work perfectly.
version = f.read( ) script_dir = os.path.dirname( os.path.abspath( __file__ ) )
except Exception as e: version = None
print( 'Failed to read VERSION %s' % e ) with open( os.path.join( script_dir, 'VERSION'), 'r' ) as f:
print( 'Using default %s' % version ) version = f.read( )
try: try:
import importlib.machinery import importlib.machinery
suffix = importlib.machinery.EXTENSION_SUFFIXES[0] suffix = importlib.machinery.EXTENSION_SUFFIXES[0]
except Exception as e: except Exception as e:
print( '[WARN] Failed to determine importlib suffix' ) print( '[WARN] Failed to determine importlib suffix due to %s' % e )
suffix = '.so' suffix = '.so'
setup( setup(
name='pymoose', name='pymoose',
version=version, version=version,
description='Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)', description='Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)',
author='MOOSERes', author='See AUTHORS.md at https://github.com/BhallaLab/moose',
author_email='bhalla@ncbs.res.in', author_email='bhalla@ncbs.res.in',
maintainer='Dilawar Singh', maintainer='Dilawar Singh',
maintainer_email='dilawars@ncbs.res.in', maintainer_email='dilawars@ncbs.res.in',
...@@ -61,9 +59,11 @@ setup( ...@@ -61,9 +59,11 @@ setup(
, 'moose.chemUtil' , 'moose.chemUtil'
, 'moose.chemMerge' , 'moose.chemMerge'
], ],
install_requires = [ 'python-libsbml', 'numpy' ], install_requires = [ 'python-libsbml', 'numpy' ],
package_dir = { package_dir = {
'moose' : 'moose', 'rdesigneur' : 'rdesigneur' 'moose' : 'moose', 'rdesigneur' : 'rdesigneur'
}, },
package_data = { 'moose' : ['_moose' + suffix, 'neuroml2/schema/NeuroMLCoreDimensions.xml'] }, package_data = {
) 'moose' : ['_moose' + suffix, 'neuroml2/schema/NeuroMLCoreDimensions.xml']
},
)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment