mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Merge branch 'master' into draw_process
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -43,3 +43,8 @@
|
||||
/dev/all_incompressibles_verbose.json
|
||||
/include/all_incompressibles_JSON.h
|
||||
fluids
|
||||
/meta.yaml
|
||||
/runner.py
|
||||
/build.sh
|
||||
/bld.bat
|
||||
/conda/
|
||||
|
||||
@@ -492,11 +492,15 @@ if (COOLPROP_OCTAVE_MODULE)
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# We need to see which library to link with on OSX - clang++ or stdc++
|
||||
execute_process(COMMAND "otool -L ${OCTAVE_OCTAVE_LIB} | grep libc++" OUTPUT_VARIABLE COOLPROP_OCTAVE_USING_CLANG)
|
||||
if ("${COOLPROP_OCTAVE_USING_CLANG} " STREQUAL " ")
|
||||
MESSAGE(STATUS "COOLPROP_OCTAVE_USING_CLANG = ${COOLPROP_OCTAVE_USING_CLANG}")
|
||||
string(STRIP "${COOLPROP_OCTAVE_USING_CLANG}" COOLPROP_OCTAVE_USING_CLANG)
|
||||
STRING(LENGTH "${COOLPROP_OCTAVE_USING_CLANG}" LEN)
|
||||
if (${LEN} GREATER 0)
|
||||
message(STATUS "Using -stdlib=libc++")
|
||||
set_target_properties(CoolProp PROPERTIES LINK_FLAGS "-stdlib=libc++")
|
||||
SET(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||
else()
|
||||
message(STATUS "Using -stdlib=libstdc++")
|
||||
SET(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -820,7 +824,7 @@ if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
|
||||
list (APPEND APP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MATLAB/Matlabdef.def) # To export mexFunction
|
||||
|
||||
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES} )
|
||||
SET(SWIG_MODULE_CoolPropMATLAB_wrap_EXTRA_DEPS ${SWIG_DEPENDENCIES} )
|
||||
|
||||
|
||||
set(SWIG_OPTIONS "${COOLPROP_SWIG_OPTIONS}")
|
||||
@@ -842,6 +846,7 @@ if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
POST_BUILD
|
||||
COMMAND python example_generator.py MATLAB "${CMAKE_CURRENT_BINARY_DIR}/Example.m"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/dev/scripts/examples")
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
POST_BUILD
|
||||
@@ -856,9 +861,22 @@ if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
|
||||
if (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES PREFIX "" SUFFIX .mexw64)
|
||||
add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E remove CoolPropMATLAB_wrap.mexw64
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
else()
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES SUFFIX .mexw32)
|
||||
add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E remove CoolPropMATLAB_wrap.mexw32
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:CoolPropMATLAB_wrap> .
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
else()
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
if (${BITNESS} EQUAL "32")
|
||||
@@ -884,6 +902,8 @@ if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
add_dependencies (CoolPropMATLAB_wrap generate_headers)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/+CoolProp.7z DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/SwigRef.m DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/CoolPropsetup.m DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Example.m DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
install (TARGETS CoolPropMATLAB_wrap DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
enable_testing()
|
||||
set(MATLAB_WAIT -wait)
|
||||
@@ -916,6 +936,8 @@ if (COOLPROP_R_MODULE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -m64")
|
||||
endif()
|
||||
|
||||
add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself
|
||||
|
||||
# Set properties before adding module
|
||||
set(I_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolProp.i")
|
||||
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${COOLPROP_SWIG_OPTIONS}" CPLUSPLUS ON)
|
||||
@@ -926,6 +948,7 @@ if (COOLPROP_R_MODULE)
|
||||
# No lib prefix for the shared library
|
||||
set_target_properties(CoolProp PROPERTIES PREFIX "")
|
||||
|
||||
add_dependencies (CoolProp generate_headers)
|
||||
add_custom_command(TARGET CoolProp
|
||||
POST_BUILD
|
||||
COMMAND python example_generator.py R "${CMAKE_CURRENT_BINARY_DIR}/Example.R"
|
||||
@@ -933,6 +956,10 @@ if (COOLPROP_R_MODULE)
|
||||
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/Example.R" DESTINATION R)
|
||||
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/CoolProp.R" DESTINATION R)
|
||||
install (TARGETS ${app_name} DESTINATION R/${CMAKE_SYSTEM_NAME}_${BITNESS}bit)
|
||||
|
||||
enable_testing()
|
||||
add_test(R_test ${R_EXEC} -f Example.R)
|
||||
|
||||
endif()
|
||||
|
||||
if (COOLPROP_MATLAB_MODULE)
|
||||
|
||||
@@ -17,12 +17,13 @@ Download the +CoolProp.7z file and extract it using the `7-zip <http://www.7-zip
|
||||
* ``computer('arch')`` yields ``glnxa64``: CoolPropMATLAB_wrap.mexa64
|
||||
* ``computer('arch')`` yields ``maci64``: CoolPropMATLAB_wrap.mexmaci64
|
||||
|
||||
Also, download the ``SwigRef.m`` file.
|
||||
Also, download the ``SwigRef.m`` and ``CoolPropsetup.m`` files.
|
||||
|
||||
When you are finished, you should have a folder layout like::
|
||||
|
||||
main
|
||||
|- SwigRef.m
|
||||
|- CoolPropsetup.m
|
||||
|- CoolPropMATLAB_wrap.mexw64
|
||||
|- +CoolProp
|
||||
|- AbstractState.m
|
||||
|
||||
@@ -22,6 +22,10 @@ At the R console, run::
|
||||
|
||||
There is example code :ref:`at the end of this page <r_example>`
|
||||
|
||||
.. warning::
|
||||
|
||||
For OSX users that wish to call REFPROP, you may be required to set the environmental variable ``DYLD_LIBRARY_PATH`` to the folder containing your REFPROP.dylib shared library, which is probably ``/opt/refprop``
|
||||
|
||||
User-Compiled Binaries
|
||||
======================
|
||||
|
||||
@@ -49,9 +53,9 @@ Once the dependencies are installed, you can run the builder and tests using::
|
||||
# Move into the folder you just created
|
||||
mkdir -p CoolProp/build && cd CoolProp/build
|
||||
# Build the makefile using CMake
|
||||
cmake .. -DCOOLPROP_R_MODULE=ON -DR_BIN="c:\Program Files\R\R-3.2.1\bin\x64" -DCMAKE_BUILD_TYPE=Release
|
||||
# Make the R files
|
||||
make install
|
||||
cmake .. -DCOOLPROP_R_MODULE=ON -DR_BIN="/usr/bin" -DCMAKE_BUILD_TYPE=Release
|
||||
# Make the R shared library
|
||||
cmake --build .
|
||||
|
||||
Windows (32-bit and 64-bit)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -80,4 +84,4 @@ Example Code
|
||||
Example Code Output
|
||||
===================
|
||||
|
||||
.. literalinclude:: Example.out
|
||||
.. literalinclude:: Example.out
|
||||
|
||||
@@ -82,10 +82,12 @@ Based on the miniconda Python ecosystem, you can create your own virtual
|
||||
environments for building the Python wheels. This requires the following
|
||||
steps on a Windows machine::
|
||||
|
||||
conda create -n CoolProp27 python=2
|
||||
conda create -n CoolProp34 python=3
|
||||
conda install -n CoolProp27 cython pip pywin32
|
||||
conda install -n CoolProp34 cython pip pywin32
|
||||
conda create -n CoolProp27 python=2.7
|
||||
conda create -n CoolProp33 python=3.3
|
||||
conda create -n CoolProp34 python=3.4
|
||||
conda install -n CoolProp27 cython pip pywin32 unxutils jinja2 pyyaml pycrypto ndg-httpsclient
|
||||
conda install -n CoolProp33 cython pip pywin32 unxutils jinja2 pyyaml pycrypto
|
||||
conda install -n CoolProp34 cython pip pywin32 unxutils jinja2 pyyaml pycrypto
|
||||
|
||||
activate CoolProp27
|
||||
pip install wheel
|
||||
@@ -98,21 +100,26 @@ Please repeat the steps above for both 32bit and 64bit Python environments.
|
||||
|
||||
On a Linux system, things only change a little bit::
|
||||
|
||||
conda create -n CoolProp27 python=2
|
||||
conda create -n CoolProp34 python=3
|
||||
conda install -n CoolProp27 cython pip
|
||||
conda install -n CoolProp34 cython pip
|
||||
conda create -n CoolProp27 python=2.7
|
||||
conda create -n CoolProp33 python=3.3
|
||||
conda create -n CoolProp34 python=3.4
|
||||
conda install -n CoolProp27 cython pip jinja2 pyyaml pycrypto
|
||||
conda install -n CoolProp33 cython pip jinja2 pyyaml pycrypto
|
||||
conda install -n CoolProp34 cython pip jinja2 pyyaml pycrypto
|
||||
|
||||
source activate CoolProp27
|
||||
pip install wheel
|
||||
deactivate
|
||||
source deactivate
|
||||
source activate CoolProp33
|
||||
pip install wheel
|
||||
source deactivate
|
||||
source activate CoolProp34
|
||||
pip install wheel
|
||||
deactivate
|
||||
source deactivate
|
||||
|
||||
Please make sure that the standard shell ``/bin/sh`` used by the builbot is
|
||||
bash or zsh. We make use of the ``source`` command, which is not part of the
|
||||
POSIX specification.
|
||||
POSIX specification. In Debian, ``dpkg-reconfigure dash`` can be used.
|
||||
|
||||
At the moment, it is not possible to use several slaves for the same build job.
|
||||
We have to find a new way to generate the configuration.
|
||||
@@ -289,7 +296,7 @@ your computer. For Debian/Ubuntu, we recommend a script like::
|
||||
# system is halted. Place it in /etc/init.d.
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Jorrit Wronski <jowr@mek.dtu.dk>
|
||||
# Author: Jorrit Wronski <jowr@ipu.dk>
|
||||
#
|
||||
# Please remove the "Author" lines above and replace them
|
||||
# with your own name if you copy and modify this script.
|
||||
@@ -317,9 +324,6 @@ your computer. For Debian/Ubuntu, we recommend a script like::
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop() {
|
||||
@@ -369,12 +373,12 @@ environment and start the buildslave. Such a script could look like this::
|
||||
# the buildbot slaves. It is also used to shut them down
|
||||
# during system shutdown.
|
||||
#
|
||||
# Author: Jorrit Wronski <jowr@mek.dtu.dk>
|
||||
# Author: Jorrit Wronski <jowr@ipu.dk>
|
||||
#
|
||||
# Please remove the "Author" lines above and replace them
|
||||
# with your own name if you copy and modify this script.
|
||||
#
|
||||
VIRTENV="/home/username/a-slave-sandbox"
|
||||
VIRTENV="a-slave-sandbox"
|
||||
SLAVEDIR="/home/username/a-slave"
|
||||
#
|
||||
## For virtualenv
|
||||
@@ -437,10 +441,11 @@ To change the MIME types on the server so that unknown file types will map prope
|
||||
and then do a ``buildbot restart master``
|
||||
|
||||
|
||||
Starting virtualbox images at boot
|
||||
Starting VirtualBox images at boot
|
||||
==================================
|
||||
|
||||
Create a daemon entry in Libray/LaunchDaemons. Make sure you use full paths to VBoxManage::
|
||||
You can use the built-in functionality https://www.virtualbox.org/manual/ch09.html#autostart on Linux and Mac or use
|
||||
your own configuration and create a daemon entry in Libray/LaunchDaemons. Make sure you use full paths to VBoxManage::
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
|
||||
@@ -21,7 +21,7 @@ library.
|
||||
* **script**: Wait for all bots to finish and run the release script by launching the ``release version`` bot with dry run disabled and the correct version number. This uploads binaries to pypi and sourceforge. Ignore the warning ``failed to set times on "/home/project-web/coolprop/htdocs/jscript/coolprop-latest.js"``, it is a symlink and will be overwritten...
|
||||
* **clean up**: If everything went well, you can proceed:
|
||||
|
||||
- Tag the release branch in your git software. It is a good idea to make and annotated tag and include the information on the closed issues here as well.
|
||||
- Tag the release branch in your git software. It is a good idea to make an annotated tag and include the information on the closed issues here as well.
|
||||
- Change the default download file on sourceforge to point to the new zipped sources.
|
||||
- Bump the version number in the CMake file and commit.
|
||||
- Announce the new features if you like...
|
||||
|
||||
@@ -59,7 +59,9 @@ c['slaves'] = [BuildSlave("linux-slave", pass_dict["linux-slave"], **slave_commo
|
||||
BuildSlave("OSX-slave", pass_dict["OSX-slave"], **slave_commons),
|
||||
BuildSlave("windows-slave", pass_dict["windows-slave"], **slave_commons),
|
||||
BuildSlave("windows-DTU-slave", pass_dict["windows-DTU-slave"], **slave_commons),
|
||||
BuildSlave("OSX-IPU-slave", pass_dict["OSX-IPU-slave"], **slave_commons)
|
||||
BuildSlave("OSX-IPU-slave", pass_dict["OSX-IPU-slave"], **slave_commons),
|
||||
BuildSlave("Linux64-IPU-slave", pass_dict["Linux64-IPU-slave"], **slave_commons),
|
||||
BuildSlave("Linux32-IPU-slave", pass_dict["Linux32-IPU-slave"], **slave_commons)
|
||||
]
|
||||
|
||||
# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
|
||||
@@ -235,37 +237,87 @@ class PythonSlaveConfig(object):
|
||||
return IDs
|
||||
|
||||
|
||||
@properties.renderer
|
||||
def gitModeInput(props):
|
||||
""" If we are doing a full clean, this will tell it to clobber all the files """
|
||||
if props.getProperty('fullclean', default = False) or props.getProperty('branch') == 'release':
|
||||
return 'full'
|
||||
else:
|
||||
return 'incremental'
|
||||
import os
|
||||
|
||||
@properties.renderer
|
||||
def masterdestLocation(props):
|
||||
def _branch(props): return props.getProperty('branch')
|
||||
|
||||
def _master_loc_rel(git_branch):
|
||||
"""
|
||||
If building from release branch, upload to public_html/release
|
||||
If building from master branch, upload to normal public_html/binaries folder
|
||||
If another branch, upload to public_html/unstable
|
||||
"""
|
||||
if props.getProperty('branch') == 'release':
|
||||
return 'public_html/release'
|
||||
elif props.getProperty('branch') == 'master':
|
||||
return 'public_html/binaries'
|
||||
else:
|
||||
return 'public_html/unstable'
|
||||
if git_branch == 'release': return os.path.join('public_html','release')
|
||||
elif git_branch == 'master': return os.path.join('public_html','binaries')
|
||||
else: return os.path.join('public_html','unstable')
|
||||
|
||||
@properties.renderer
|
||||
def master_loc_rel(props):
|
||||
"""
|
||||
If building from release branch, upload to public_html/release
|
||||
If building from master branch, upload to normal public_html/binaries folder
|
||||
If another branch, upload to public_html/unstable
|
||||
"""
|
||||
return _master_loc_rel(props.getProperty('branch'))
|
||||
|
||||
def _master_loc_abs(git_branch):
|
||||
server_uri = 'coolprop@coolprop.dreamhosters.com'
|
||||
server_dir = '/home/coolprop/buildbot/server-master'
|
||||
server_dir = os.path.join(server_dir, _master_loc_rel(git_branch))
|
||||
server_des = "{0}:{1}".format(server_uri, os.path.abspath(server_dir))
|
||||
return server_des
|
||||
|
||||
@properties.renderer
|
||||
def master_loc_abs(props):
|
||||
return _master_loc_abs(props.getProperty('branch'))
|
||||
|
||||
############# Upload folder permissions #######################
|
||||
def fixPermissions(factory):
|
||||
factory.addStep(MasterShellCommand(command = '${HOME}/scripts/binPerms.sh'))
|
||||
|
||||
def upload_command(factory, slavesrc, masterdest=None, branch=None, platform=None, pyID=None):
|
||||
"""Upload files to the master server. Avoids buildbot upload on platforms other than Windows."""
|
||||
if (masterdest is not None and branch is not None):
|
||||
raise ValueError("Unknown target, specify either \"masterdest\" or \"branch\".")
|
||||
if (platform is not None and pyID is not None):
|
||||
raise ValueError("Unknown target, specify either \"platform\" or \"pyID\".")
|
||||
|
||||
if masterdest is not None: target = masterdest
|
||||
elif branch is not None: target = _master_loc_rel(branch)
|
||||
else: target = master_loc_rel
|
||||
if platform is None and pyID is None: # default
|
||||
factory.addStep(DirectoryUpload(slavesrc=slavesrc, masterdest=target))
|
||||
elif (platform is not None and platform == 'windows') or \
|
||||
(pyID is not None and checkID(pyID, teID=100, strict=False)):
|
||||
factory.addStep(DirectoryUpload(slavesrc=slavesrc, masterdest=target))
|
||||
else:
|
||||
if masterdest is not None: target = masterdest
|
||||
elif branch is not None: target = _master_loc_abs(branch)
|
||||
else: target = master_loc_abs
|
||||
rsyncCommand = ['rsync', '-aP', '--no-perms', '--no-owner', '--no-group', '--stats', '{0}/'.format(slavesrc), target]
|
||||
factory.addStep(ShellCommand(command=rsyncCommand, haltOnFailure = True))
|
||||
fixPermissions(factory)
|
||||
|
||||
|
||||
# A centralised method to provide the objects with some presets
|
||||
def getBaseFactory(gitMode = 'incremental'):
|
||||
@properties.renderer
|
||||
def _git_mode(props):
|
||||
""" If we are doing a full clean, this will tell it to clobber all the files """
|
||||
if props.getProperty('fullclean',default=False) or props.getProperty('branch',default='master') == 'release':
|
||||
return 'full'
|
||||
else:
|
||||
return 'incremental'
|
||||
|
||||
def getBaseFactory():
|
||||
factory = BuildFactory()
|
||||
factory.addStep(Git(repourl='git://github.com/CoolProp/CoolProp', mode=gitModeInput, method = 'fresh', submodules = True, progress=True, haltOnFailure = True))
|
||||
factory.addStep(Git(
|
||||
repourl= 'git://github.com/CoolProp/CoolProp',
|
||||
mode = _git_mode,
|
||||
method = 'fresh',
|
||||
submodules = True,
|
||||
progress=True,
|
||||
haltOnFailure = True))
|
||||
return factory
|
||||
|
||||
def docActivateCmd():
|
||||
@@ -301,12 +353,12 @@ def rsyncCommand(props):
|
||||
|
||||
# All what is needed to create the website, it makes sense to run the
|
||||
# nightly builds on the same machine. This avoids extra data transfer.
|
||||
def websiteFactory(platform, gitMode='incremental', fullBuild=False):
|
||||
def websiteFactory(platform, fullBuild=False):
|
||||
if 'win' in platform.lower():
|
||||
raise ValueError("The docs cannot be build on a Windows machine, we rely on rsync...")
|
||||
#
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
# Make a wheel - this is advantageous because it forces pip to uninstall coolprop, ensuring that all files installed are from this wheel
|
||||
factory.addStep(ShellCommand(command=' '.join([docActivateCmd(), "python", "setup.py", "bdist_wheel", '--dist-dir', 'dist']), workdir= 'build/wrappers/Python', haltOnFailure = True))
|
||||
# List the files in the dist directory
|
||||
@@ -339,17 +391,14 @@ def websiteFactory(platform, gitMode='incremental', fullBuild=False):
|
||||
# Currently, it only supports Windows, but the plan is to integrate MacOS and Linux builds here as well.
|
||||
# You have to have both CMake and Git available on your standard command line, pay attention when installing
|
||||
# these two tools on your Windows machine.
|
||||
def pythonFactory(pyID, pyCFG=PythonSlaveConfig("name"), gitMode='incremental'):
|
||||
def pythonFactory(pyID, pyCFG=PythonSlaveConfig("name")):
|
||||
#
|
||||
# Some basic settings for all builders
|
||||
workingFolder = "build/wrappers/Python"
|
||||
installFolder = "build/install_root"
|
||||
relinstFolder = "../../install_root" # relative path
|
||||
uploadFolder = "install_root" # relative to build
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
# Remove the temporary folder for installs
|
||||
factory.addStep(RemoveDirectory(dir=installFolder, haltOnFailure = False))
|
||||
# Do you want me to install the required packages? Enable this for new slaves.
|
||||
installPackages = False
|
||||
buildPyPI = checkID(pyID, teID=100, strict=False) or checkID(pyID, teID=200, strict=False) # Only build and upload Windows and Mac wheels
|
||||
buildConda = True
|
||||
workingFolder = "build/wrappers/Python"
|
||||
installFolder = "install_root"
|
||||
#
|
||||
# Setting the appropriate virtual environment activator
|
||||
pyact = pyCFG.getPyact(pyID)
|
||||
@@ -366,28 +415,57 @@ def pythonFactory(pyID, pyCFG=PythonSlaveConfig("name"), gitMode='incremental'):
|
||||
# Getting the appropriate installer options
|
||||
if pyins is None:
|
||||
raise ValueError("Your selected Python environment \"{0}\" does not have installer options in this builder factory".format(pyID))
|
||||
|
||||
#
|
||||
pkgs = ["requests", "jinja2", "pyyaml", "numpy", "scipy", "matplotlib", "pandas", "cython"]
|
||||
if checkID(pyID, teID=100, strict=False):
|
||||
pkgs.extend(["unxutils","pywin32"]) # Add Windows-only dependency
|
||||
if checkID(pyID, teID=101, strict=False):
|
||||
pkgs.append("ndg-httpsclient") # Add Windows-only and python2 dependency
|
||||
#
|
||||
activateCMD = " ".join([pyact, pyenv]) # We always activate an environment, regardless of the host
|
||||
installCMD = " ".join(["python", "setup.py"] + pyins)
|
||||
combinedCMD = " && ".join([activateCMD, installCMD])
|
||||
factory.addStep(ShellCommand(command = combinedCMD, workdir = workingFolder, haltOnFailure = True))
|
||||
def combinedCMD(cmd): return " && ".join([activateCMD, cmd])
|
||||
#
|
||||
#factory.addStep(ShellCommand(command="python -c \"import CoolProp; print(CoolProp.__file___)\"", workdir= workingFolder, haltOnFailure = True))
|
||||
#
|
||||
if not checkID(pyID, teID=300, strict=False): # Only upload non-Linux files
|
||||
factory.addStep(DirectoryUpload(slavesrc=uploadFolder, masterdest=masterdestLocation, url="binaries", compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
if buildPyPI:
|
||||
# Install dependencies
|
||||
if installPackages and False: # disabled
|
||||
installCMD = " ".join(["pip", "install"]) + " " + " ".join(pkgs)
|
||||
factory.addStep(ShellCommand(command=combinedCMD(installCMD), haltOnFailure=True))
|
||||
# setuptools installation for PyPI packages
|
||||
factory.addStep(RemoveDirectory(dir=os.path.join('build',installFolder), haltOnFailure = False))
|
||||
installCMD = " ".join(["python", "setup.py"] + pyins)
|
||||
factory.addStep(ShellCommand(command=combinedCMD(installCMD), workdir=workingFolder, haltOnFailure=True))
|
||||
installCMD = " ".join(["python", "setup.py", "clean"])
|
||||
factory.addStep(ShellCommand(command=combinedCMD(installCMD), workdir=workingFolder, haltOnFailure=True))
|
||||
upload_command(factory, installFolder, pyID=pyID)
|
||||
|
||||
if buildConda:
|
||||
# Install dependencies
|
||||
if installPackages:
|
||||
installCMD = " ".join(["conda", "install", "-yq"]) + " " + " ".join(pkgs)
|
||||
factory.addStep(ShellCommand(command=combinedCMD(installCMD), haltOnFailure=True))
|
||||
# conda installation for binstar packages
|
||||
factory.addStep(RemoveDirectory(dir=os.path.join('build',installFolder), haltOnFailure = False))
|
||||
factory.addStep(RemoveDirectory(dir=os.path.join(workingFolder,'build'), haltOnFailure = False))
|
||||
factory.addStep(RemoveDirectory(dir=os.path.join(workingFolder,'src'), haltOnFailure = False))
|
||||
installCMD = " ".join(["python", "generate_meta.yaml.py"])
|
||||
factory.addStep(ShellCommand(command=combinedCMD(installCMD), workdir=workingFolder, haltOnFailure=True))
|
||||
installCMD = " ".join(["python", "runner.py"])
|
||||
factory.addStep(ShellCommand(command=combinedCMD(installCMD), workdir='build', haltOnFailure=True))
|
||||
upload_command(factory, installFolder, pyID=pyID)
|
||||
|
||||
return factory
|
||||
|
||||
|
||||
def cmakeFactory(mod_name = None, gitMode = 'incremental', install = True, pre_cmd = [], cmake_args = [], build_args = [], ctest_args = [], cmake_env={}, test = True):
|
||||
def cmakeFactory(mod_name = None, install = True, pre_cmd = [], cmake_args = [], build_args = [], ctest_args = [], cmake_env={}, test = True):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
mod_name: string
|
||||
The module to be built, one of 'Octave','python','Csharp', etc. - turns on the macro -DCOOLPROP_OCTAVE_MODULE=ON for instance if you pass octave
|
||||
gitMode: string
|
||||
What mode to use, one of 'incremental' or 'full'
|
||||
install: bool
|
||||
True for install, False for just build
|
||||
pre_cmd: list of strings
|
||||
@@ -404,7 +482,7 @@ def cmakeFactory(mod_name = None, gitMode = 'incremental', install = True, pre_c
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
factory.addStep(MakeDirectory(dir=working_folder, haltOnFailure = True))
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = False))
|
||||
@@ -436,7 +514,7 @@ def cmakeFactory(mod_name = None, gitMode = 'incremental', install = True, pre_c
|
||||
if install:
|
||||
factory.addStep(DirectoryUpload(
|
||||
slavesrc="install_root",
|
||||
masterdest=masterdestLocation,
|
||||
masterdest=master_loc_rel,
|
||||
url="binaries",
|
||||
compress="bz2"))
|
||||
return factory
|
||||
@@ -479,13 +557,13 @@ def fortranFactory(platform=1,bitness=1):
|
||||
return factory
|
||||
|
||||
|
||||
def javascript_slave(platform, cmake_args = [], cmake_env = {}, build_args = [], gitMode = 'incremental'):
|
||||
def javascript_slave(platform, cmake_args = [], cmake_env = {}, build_args = []):
|
||||
|
||||
working_folder = "build/Javascript"
|
||||
from buildbot.process.properties import WithProperties
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
|
||||
# Remove the temporary folder for installs
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = False))
|
||||
@@ -494,15 +572,15 @@ def javascript_slave(platform, cmake_args = [], cmake_env = {}, build_args = [],
|
||||
workdir= working_folder,
|
||||
haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=["cmake", "--build", ".", "--target", "install"]+build_args, workdir = working_folder, haltOnFailure = True))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest=masterdestLocation, url="binaries", compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest=master_loc_rel, url="binaries", compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
def python_source_slave(key, platform, conda_env, cmake_args = [], cmake_env = {}, build_args = [], gitMode = 'incremental'):
|
||||
def python_source_slave(key, platform, conda_env, cmake_args = [], cmake_env = {}, build_args = []):
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
|
||||
# Remove the temporary folder for installs
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = False))
|
||||
@@ -512,16 +590,16 @@ def python_source_slave(key, platform, conda_env, cmake_args = [], cmake_env = {
|
||||
env = cmake_env,
|
||||
workdir= working_folder,
|
||||
haltOnFailure = True))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest=masterdestLocation, url="binaries", compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest=master_loc_rel, url="binaries", compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
# def deb_slave(gitMode = 'incremental'):
|
||||
# def deb_slave():
|
||||
#
|
||||
# working_folder = "build/wrappers/DEB"
|
||||
#
|
||||
# # Create the factory to add the actions to
|
||||
# factory = getBaseFactory(gitMode=gitMode)
|
||||
# factory = getBaseFactory()
|
||||
#
|
||||
# factory.addStep(ShellCommand(command = ' '.join(["chmod","+x","package.bsh","&&", "./package.bsh"]),
|
||||
# workdir= working_folder,
|
||||
@@ -530,17 +608,17 @@ def python_source_slave(key, platform, conda_env, cmake_args = [], cmake_env = {
|
||||
# factory.addStep(ShellCommand(command = ' '.join(["mv","*.deb","DEB/DEB"]),
|
||||
# workdir= working_folder,
|
||||
# haltOnFailure = True))
|
||||
# factory.addStep(DirectoryUpload(slavesrc="wrappers/DEB/DEB", masterdest=masterdestLocation, url="binaries/DEB", compress="bz2"))
|
||||
# factory.addStep(DirectoryUpload(slavesrc="wrappers/DEB/DEB", masterdest=master_loc_rel, url="binaries/DEB", compress="bz2"))
|
||||
#
|
||||
# return factory
|
||||
|
||||
def excel_slave(gitMode = 'incremental'):
|
||||
def excel_slave():
|
||||
"""
|
||||
"""
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
factory.addStep(MakeDirectory(dir='build/bin/MicrosoftExcel', haltOnFailure = True))
|
||||
factory.addStep(MakeDirectory(dir=working_folder+'/32bitDLL', haltOnFailure = True))
|
||||
@@ -574,17 +652,17 @@ def excel_slave(gitMode = 'incremental'):
|
||||
factory.addStep(ShellCommand(command=["copy", "wrappers\Excel\CoolProp.xla", "bin\MicrosoftExcel"], workdir = 'build', haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=["copy", "wrappers\Excel\TestExcel.xlsx", "bin\MicrosoftExcel"], workdir = 'build', haltOnFailure = True))
|
||||
# Upload the files
|
||||
factory.addStep(DirectoryUpload(slavesrc="bin",masterdest=masterdestLocation,url="MicrosoftExcel",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="bin",masterdest=master_loc_rel,url="MicrosoftExcel",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
def smath_builder(gitMode = 'incremental'):
|
||||
def smath_builder():
|
||||
"""
|
||||
"""
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
factory.addStep(MakeDirectory(dir='build/bin/SMath', haltOnFailure = True))
|
||||
factory.addStep(MakeDirectory(dir=working_folder+'/32bitDLL', haltOnFailure = True))
|
||||
@@ -621,35 +699,33 @@ def smath_builder(gitMode = 'incremental'):
|
||||
factory.addStep(ShellCommand(command=["build_zip"], workdir = 'build\\wrappers\\SMath\\coolprop_wrapper', haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=["copy", "/Y", "wrappers\\SMath\\coolprop_wrapper\\coolprop_wrapper.7z", "bin\\SMath"], workdir = 'build', haltOnFailure = True))
|
||||
# Upload the files
|
||||
factory.addStep(DirectoryUpload(slavesrc="bin",masterdest=masterdestLocation,url="SMath",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="bin",masterdest=master_loc_rel,url="SMath",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
def julia_builder(gitMode = 'incremental'):
|
||||
def julia_builder():
|
||||
"""
|
||||
"""
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
# Clean the install_root
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root/Julia", haltOnFailure = False))
|
||||
factory.addStep(MakeDirectory(dir='build/install_root/Julia', haltOnFailure = True))
|
||||
# Copy other files
|
||||
factory.addStep(ShellCommand(command=["cp", "wrappers/Julia/CoolProp.jl", "install_root/Julia/"], workdir = 'build', haltOnFailure = True))
|
||||
# Upload the files - TODO: Is this the correct directory?
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=masterdestLocation,url="binaries",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=master_loc_rel,url="binaries",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
def cmake_slave(mod_name, platform, gitMode = 'incremental', install = True, cmake_args = [], build_args = [], ctest_args = [], cmake_env={}, test = True):
|
||||
def cmake_slave(mod_name, platform, install = True, cmake_args = [], build_args = [], ctest_args = [], cmake_env={}, test = True):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
mod_name: string
|
||||
The module to be built, one of 'Octave','python','Csharp', etc. - turns on the macro -DCOOLPROP_OCTAVE_MODULE=ON for instance if you pass octave
|
||||
gitMode: string
|
||||
What mode to use, one of 'incremental' or 'full'
|
||||
install: bool
|
||||
True for install, False for just build
|
||||
cmake_args: list of strings
|
||||
@@ -664,7 +740,7 @@ def cmake_slave(mod_name, platform, gitMode = 'incremental', install = True, cma
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
factory.addStep(MakeDirectory(dir=working_folder, haltOnFailure = True))
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True))
|
||||
@@ -681,13 +757,13 @@ def cmake_slave(mod_name, platform, gitMode = 'incremental', install = True, cma
|
||||
else:
|
||||
factory.addStep(ShellCommand(command=' '.join(pre+["cmake", "--build", "."]+build_args), workdir = working_folder, haltOnFailure = True))
|
||||
if test:
|
||||
factory.addStep(ShellCommand(command=["ctest", "--extra-verbose"] + ctest_args, workdir = working_folder, haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=["ctest", "--extra-verbose"] + ctest_args, workdir = working_folder, haltOnFailure = True, env = cmake_env))
|
||||
if install:
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=masterdestLocation,url="binaries",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=master_loc_rel,url="binaries",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
def swig_matlab_builder(platform, gitMode = 'incremental', build_args = [], cmake_args = [], ctest_args = [], cmake_env = None):
|
||||
def swig_matlab_builder(platform, build_args = [], cmake_args = [], ctest_args = [], cmake_env = None):
|
||||
"""
|
||||
Download SWIG+MATLAB version, use it to build _wrap file for MATLAB builder, upload generated file back to master.
|
||||
|
||||
@@ -704,7 +780,7 @@ def swig_matlab_builder(platform, gitMode = 'incremental', build_args = [], cmak
|
||||
return pre_path+cmd
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
# Download files from nightly build for swig
|
||||
factory.addStep(FileDownload(mastersrc = 'public_html/nightly/swig+MATLAB/'+platform+'/swig_MATLAB.7z',
|
||||
@@ -722,15 +798,14 @@ def swig_matlab_builder(platform, gitMode = 'incremental', build_args = [], cmak
|
||||
factory.addStep(ShellCommand(command=prepend_path('cmake --build . --target install ' + ' '.join(build_args)),
|
||||
workdir= "build/build" , haltOnFailure = True))
|
||||
# Run simple integration test, but only on platforms other than windows
|
||||
if 'win' not in platform:
|
||||
factory.addStep(ShellCommand(command=["ctest", "--extra-verbose"] + ctest_args, workdir = "build/build", haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=["ctest", "--extra-verbose"] + ctest_args, workdir = "build/build", haltOnFailure = True))
|
||||
# Upload the files
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=masterdestLocation,url="binaries",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=master_loc_rel,url="binaries",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
# Return the object
|
||||
return factory
|
||||
|
||||
def swig_scilab_builder(platform, gitMode = 'incremental'):
|
||||
def swig_scilab_builder(platform):
|
||||
"""
|
||||
Download SWIG+scilab version on linux, use it to build _wrap file for scilab builder, upload generated file(s) back to master.
|
||||
|
||||
@@ -740,7 +815,7 @@ def swig_scilab_builder(platform, gitMode = 'incremental'):
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
#
|
||||
# Download files from nightly build for swig
|
||||
factory.addStep(FileDownload(mastersrc = 'public_html/nightly/swig+SCILAB/'+platform+'/swig_SCILAB.7z', slavedest = 'swig_SCILAB.7z', haltOnFailure = True))
|
||||
@@ -763,14 +838,14 @@ def swig_scilab_builder(platform, gitMode = 'incremental'):
|
||||
workdir= "build/build",
|
||||
haltOnFailure = True))
|
||||
# Upload the files
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=masterdestLocation,url="binaries",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root",masterdest=master_loc_rel,url="binaries",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
def SWIG_MATLAB_bin_builder(platform, gitMode = 'incremental', windows = False):
|
||||
def SWIG_MATLAB_bin_builder(platform, windows = False):
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
# Build SWIG with MATLAB
|
||||
args = ["python","build_swig_matlab.py"]
|
||||
if windows:
|
||||
@@ -791,10 +866,10 @@ def SWIG_MATLAB_bin_builder(platform, gitMode = 'incremental', windows = False):
|
||||
compress="bz2"))
|
||||
return factory
|
||||
|
||||
def SWIG_scilab_bin_builder(platform, gitMode = 'incremental', windows = False):
|
||||
def SWIG_scilab_bin_builder(platform, windows = False):
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
# Build SWIG with scilab
|
||||
args = ["python","build_swig_scilab.py"]
|
||||
if windows:
|
||||
@@ -825,13 +900,13 @@ def memory_sanitizer_builder():
|
||||
commons = dict(workdir = 'build/asan', haltOnFailure = True, env = dict(CLANG_ROOT = CLANG_ROOT))
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
factory.addStep(MakeDirectory(dir='build/asan', haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command='cmake .. -DCOOLPROP_CLANG_ADDRESS_SANITIZER=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_C_COMPILER=${CLANG_ROOT}/bin/clang -DCMAKE_CXX_COMPILER=${CLANG_ROOT}/bin/clang++', **commons))
|
||||
factory.addStep(ShellCommand(command='DYLD_LIBRARY_PATH=${CLANG_ROOT}/lib/clang/3.5.0/lib/darwin/ ASAN_SYMBOLIZER_PATH=${CLANG_ROOT}/bin/llvm-symbolizer ASAN_OPTIONS=verbosity=1 cmake --build .', **commons))
|
||||
return factory
|
||||
|
||||
def vxworks_module_builder(gitMode = 'incremental', cmake_args = [], cmake_env = None):
|
||||
def vxworks_module_builder(cmake_args = [], cmake_env = None):
|
||||
"""
|
||||
These generated files are needed for the other swig builders and are cross-platform
|
||||
"""
|
||||
@@ -839,7 +914,7 @@ def vxworks_module_builder(gitMode = 'incremental', cmake_args = [], cmake_env =
|
||||
working_folder = "build/build"
|
||||
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
factory = getBaseFactory()
|
||||
# Directory for build
|
||||
factory.addStep(MakeDirectory(dir='build/build', haltOnFailure = True))
|
||||
# Generate makefile
|
||||
@@ -847,7 +922,7 @@ def vxworks_module_builder(gitMode = 'incremental', cmake_args = [], cmake_env =
|
||||
# Build
|
||||
factory.addStep(ShellCommand(command = 'cmake --build . --target install', workdir = 'build/build', haltOnFailure = True))
|
||||
# Upload the files
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest=masterdestLocation,url="binaries",compress="bz2"))
|
||||
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest=master_loc_rel,url="binaries",compress="bz2"))
|
||||
fixPermissions(factory)
|
||||
return factory
|
||||
|
||||
@@ -914,8 +989,8 @@ relinstFolder = "../../install_root" # relative path
|
||||
baseins = ['bdist_wheel', '--dist-dir', relinstFolder+'/Python']
|
||||
|
||||
windowsDTUslave = PythonSlaveConfig("windows-DTU-slave")
|
||||
windowsDTUslave.pyact[getIDstr("windows", "32bit", 0 )] = "\"C:\\Program Files (x86)\\Miniconda32_27\\Scripts\\activate.bat\""
|
||||
windowsDTUslave.pyact[getIDstr("windows", "64bit", 0 )] = "\"C:\\Program Files\\Miniconda64_27\\Scripts\\activate.bat\""
|
||||
windowsDTUslave.pyact[getIDstr("windows", "32bit", 0 )] = "set \"PATH=C:\\Program Files (x86)\\Miniconda32_27\\Scripts;%PATH%\" && activate"
|
||||
windowsDTUslave.pyact[getIDstr("windows", "64bit", 0 )] = "set \"PATH=C:\\Program Files\\Miniconda64_27\\Scripts;%PATH%\" && activate"
|
||||
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py27")] = "CoolProp27"
|
||||
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py33")] = "CoolProp33"
|
||||
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py34")] = "CoolProp34"
|
||||
@@ -948,7 +1023,21 @@ osxIPUslave.pyenv[getIDstr( "osx" , "64bit", "py33")] = "CoolProp33"
|
||||
osxIPUslave.pyenv[getIDstr( "osx" , "64bit", "py34")] = "CoolProp34"
|
||||
osxIPUslave.pyins[getIDstr( "osx" , 0 , 0 )] = baseins
|
||||
|
||||
pythonSlaves = [windowsDTUslave, osxIPUslave]
|
||||
l64IPUslave = PythonSlaveConfig("Linux64-IPU-slave")
|
||||
l64IPUslave.pyact[getIDstr( "linux" , "64bit", 0 )] = "source /home/jowr/miniconda3/bin/activate"
|
||||
l64IPUslave.pyenv[getIDstr( "linux" , "64bit", "py27")] = "CoolProp27"
|
||||
l64IPUslave.pyenv[getIDstr( "linux" , "64bit", "py33")] = "CoolProp33"
|
||||
l64IPUslave.pyenv[getIDstr( "linux" , "64bit", "py34")] = "CoolProp34"
|
||||
l64IPUslave.pyins[getIDstr( "linux" , 0 , 0 )] = baseins
|
||||
|
||||
l32IPUslave = PythonSlaveConfig("Linux32-IPU-slave")
|
||||
l32IPUslave.pyact[getIDstr( "linux" , "32bit", 0 )] = "source /home/jowr/miniconda3/bin/activate"
|
||||
l32IPUslave.pyenv[getIDstr( "linux" , "32bit", "py27")] = "CoolProp27"
|
||||
l32IPUslave.pyenv[getIDstr( "linux" , "32bit", "py33")] = "CoolProp33"
|
||||
l32IPUslave.pyenv[getIDstr( "linux" , "32bit", "py34")] = "CoolProp34"
|
||||
l32IPUslave.pyins[getIDstr( "linux" , 0 , 0 )] = baseins
|
||||
|
||||
pythonSlaves = [windowsDTUslave, osxIPUslave, l64IPUslave, l32IPUslave]
|
||||
|
||||
for slave in pythonSlaves:
|
||||
for pyID in slave.getIDs():
|
||||
@@ -956,7 +1045,7 @@ for slave in pythonSlaves:
|
||||
BuilderConfig(
|
||||
name="-".join(["Python", "binaries", getJobName(pyID)]),
|
||||
slavenames=[slave.name],
|
||||
factory = pythonFactory(pyID, pyCFG=slave, gitMode = 'incremental')
|
||||
factory = pythonFactory(pyID, pyCFG=slave)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -977,12 +1066,12 @@ for slave in pythonSlaves:
|
||||
# BuilderConfig(
|
||||
# name="-".join(["Python", "binaries", getJobName(pyID)]),
|
||||
# slavenames=enabledIDs[pyID],
|
||||
# factory = pythonFactory(pyID, pyCFG=slave, gitMode = 'incremental')
|
||||
# factory = pythonFactory(pyID, pyCFG=slave)
|
||||
# )
|
||||
# )
|
||||
|
||||
windowsDTUslave.pyact[getIDstr("windows", "32bit", 0 )] = "\"C:\\Program Files (x86)\\Miniconda32_27\\Scripts\\activate.bat\""
|
||||
windowsDTUslave.pyact[getIDstr("windows", "64bit", 0 )] = "\"C:\\Program Files\\Miniconda64_27\\Scripts\\activate.bat\""
|
||||
windowsDTUslave.pyact[getIDstr("windows", "32bit", 0 )] = "set \"PATH=C:\\Program Files (x86)\\Miniconda32_27\\Scripts;%PATH%\" && activate"
|
||||
windowsDTUslave.pyact[getIDstr("windows", "64bit", 0 )] = "set \"PATH=C:\\Program Files\\Miniconda64_27\\Scripts;%PATH%\" && activate"
|
||||
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py27")] = "CoolProp27"
|
||||
|
||||
c['builders'].append(
|
||||
@@ -1034,17 +1123,26 @@ c['builders'].append(
|
||||
#Common boring 64-bit modules for windows, linux and OSX
|
||||
### OSX
|
||||
for platform in ['OSX', 'linux', 'windows']:
|
||||
for wrapper in ['Java','Csharp','Octave','PHP','64BIT_SHARED_LIBRARY','64BIT_STATIC_LIBRARY','MATHEMATICA','VBDOTNET']:
|
||||
for wrapper in ['Java','Csharp','Octave','PHP','64BIT_SHARED_LIBRARY','64BIT_STATIC_LIBRARY','MATHEMATICA','VBDOTNET','R']:
|
||||
if wrapper == 'PHP' and platform != 'linux': continue # only build PHP on linux
|
||||
if wrapper == 'VBDOTNET' and not platform.startswith('windows'): continue # only build VB.net on windows
|
||||
ctest_args, cmake_args, build_args = [], ['-DCMAKE_BUILD_TYPE=Release','-DCMAKE_VERBOSE_MAKEFILE=ON'], ['--config','Release']
|
||||
cmake_env = {}
|
||||
if wrapper == '64BIT_SHARED_LIBRARY':
|
||||
cmake_args += ['-DCOOLPROP_SHARED_LIBRARY=ON']
|
||||
if wrapper == '64BIT_STATIC_LIBRARY':
|
||||
cmake_args += ['-DCOOLPROP_STATIC_LIBRARY=ON','-DCOOLPROP_EXTERNC_LIBRARY=ON']
|
||||
if wrapper == 'R':
|
||||
if platform.startswith('windows'):
|
||||
cmake_args += ['-DR_BIN="C:/Program Files/R/R-3.2.1/bin/x64"']
|
||||
elif platform == 'OSX':
|
||||
cmake_args += ['-DR_BIN="/usr/bin"']
|
||||
cmake_env = {'DYLD_LIBRARY_PATH': '/opt/refprop'}
|
||||
else:
|
||||
cmake_args += ['-DR_BIN="/usr/bin"']
|
||||
if platform.startswith('windows'):
|
||||
ctest_args = ['-C', 'Release']
|
||||
if wrapper == 'Octave':
|
||||
if wrapper in ['Octave', 'R']:
|
||||
cmake_args += ['-G', '"MinGW Makefiles"']
|
||||
elif wrapper == 'VBDOTNET':
|
||||
cmake_args += ['-G', '"Visual Studio 11 2012 Win64"']
|
||||
@@ -1058,6 +1156,7 @@ for platform in ['OSX', 'linux', 'windows']:
|
||||
slavenames=[platform + platmod +"-slave"],
|
||||
factory = cmake_slave(wrapper,
|
||||
platform = platform,
|
||||
cmake_env = cmake_env,
|
||||
ctest_args = ctest_args,
|
||||
cmake_args = cmake_args,
|
||||
build_args = build_args)
|
||||
|
||||
@@ -17,10 +17,11 @@ ENDIF()
|
||||
find_program(R_EXEC
|
||||
NAMES R
|
||||
PATHS ${R_BIN}
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_PATH
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${R_EXEC} RHOME OUTPUT_VARIABLE R_HOME_TEXT RESULT_VARIABLE R_HOME_RESULT
|
||||
)
|
||||
MESSAGE(STATUS "R_EXEC= ${R_EXEC}")
|
||||
# Parse the output of the R path commmand, removing whitespace
|
||||
FUNCTION(chomp arg1 arg2)
|
||||
@@ -32,9 +33,15 @@ FUNCTION(chomp arg1 arg2)
|
||||
# see http://www.cmake.org/pipermail/cmake/2008-November/025423.html
|
||||
set(${arg2} ${arg1path} PARENT_SCOPE)
|
||||
ENDFUNCTION(chomp)
|
||||
STRING(STRIP ${R_HOME_TEXT} R_HOME_TEXT)
|
||||
MESSAGE(STATUS "R_HOME_TEXT = ${R_HOME_TEXT}")
|
||||
MESSAGE(STATUS "R_HOME_RESULT = ${R_HOME_RESULT}")
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/get_home.R R.home())
|
||||
execute_process(
|
||||
COMMAND ${R_EXEC} --quiet -f ${CMAKE_CURRENT_BINARY_DIR}/get_home.R OUTPUT_VARIABLE R_HOME_TEXT RESULT_VARIABLE R_HOME_RESULT
|
||||
)
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/get_home.R)
|
||||
MESSAGE(STATUS "R_HOME_TEXT = ${R_HOME_TEXT} w/ RESULT=${R_HOME_RESULT}")
|
||||
chomp(${R_HOME_TEXT} R_HOME_TEXT)
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/get_include.R R.home(component=\"include\"))
|
||||
execute_process(
|
||||
COMMAND ${R_EXEC} --quiet -f ${CMAKE_CURRENT_BINARY_DIR}/get_include.R OUTPUT_VARIABLE R_INCLUDE_TEXT RESULT_VARIABLE R_INCLUDE_RESULT
|
||||
|
||||
@@ -20,11 +20,18 @@ function git_pull {
|
||||
fi
|
||||
popd
|
||||
}
|
||||
function git_cfg {
|
||||
pushd /home/$USER/buildbot/CoolProp.git
|
||||
git reset HEAD dev/buildbot/master/master.cfg
|
||||
git checkout -- dev/buildbot/master/master.cfg
|
||||
popd
|
||||
}
|
||||
function stop {
|
||||
buildbot stop /home/$USER/buildbot/server-master/
|
||||
}
|
||||
function clean {
|
||||
rm -f /home/$USER/buildbot/server-master/buildbot_private.pyc
|
||||
python /home/$USER/buildbot/server-master/buildbot_private.py
|
||||
}
|
||||
#
|
||||
# Check for input
|
||||
@@ -38,6 +45,11 @@ elif [ "$CMD" = "reconfig" ]; then
|
||||
git_pull
|
||||
clean
|
||||
reconfig
|
||||
elif [ "$CMD" = "reconfigmaster" ]; then
|
||||
git_cfg
|
||||
git_pull
|
||||
clean
|
||||
reconfig
|
||||
elif [ "$CMD" = "start" ]; then
|
||||
git_pull
|
||||
clean
|
||||
|
||||
@@ -10,8 +10,8 @@ def tee_call(call, file, **kwargs):
|
||||
**kwargs)
|
||||
stdout, stderr = callee.communicate()
|
||||
print(stdout, stderr)
|
||||
file.write(stdout.decode('ascii'))
|
||||
file.write(stderr.decode('ascii'))
|
||||
file.write(stdout)
|
||||
file.write(stderr)
|
||||
if callee.poll() != 0:
|
||||
raise ValueError('Return code is non-zero')
|
||||
|
||||
@@ -70,10 +70,10 @@ if __name__=='__main__':
|
||||
RR = R()
|
||||
RR.write('R/Example.R', RR.parse())
|
||||
kwargs = dict(stdout = sys.stdout, stderr = sys.stderr, shell = True, cwd = 'R')
|
||||
subprocess.check_call('cmake ../../../.. -DCOOLPROP_R_MODULE=ON -DCMAKE_VERBOSE_MAKEFILE=ON', **kwargs)
|
||||
subprocess.check_call('cmake ../../../.. -DCOOLPROP_R_MODULE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DR_BIN=/usr/bin', **kwargs)
|
||||
subprocess.check_call('cmake --build .', **kwargs)
|
||||
with open('R/Example.out','w') as fp:
|
||||
tee_call(r'R Example.R', fp, shell = True, cwd = 'R')
|
||||
tee_call(r'DYLD_LIBRARY_PATH=/opt/refprop R -f Example.R', fp, shell = True, cwd = 'R')
|
||||
copyfiles('R','R')
|
||||
|
||||
if not os.path.exists('MATLAB'): os.mkdir('MATLAB')
|
||||
|
||||
@@ -800,9 +800,6 @@ class MATLAB(BaseParser):
|
||||
type_name_mapping = {'vector': None,
|
||||
'AbstractState': None}
|
||||
indentation = ''
|
||||
|
||||
def __init__(self):
|
||||
self.pieces = high_level_interface + low_level_interface
|
||||
|
||||
def parse_arguments(self, arguments):
|
||||
out = []
|
||||
|
||||
2
externals/REFPROP-headers
vendored
2
externals/REFPROP-headers
vendored
Submodule externals/REFPROP-headers updated: f452de5261...62a1244115
@@ -144,7 +144,9 @@ protected:
|
||||
/// Using this backend, calculate the universal gas constant \f$R_u\f$ in J/mol/K
|
||||
virtual CoolPropDbl calc_gas_constant(void){ throw NotImplementedError("calc_gas_constant is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the fugacity coefficient (dimensionless)
|
||||
virtual CoolPropDbl calc_fugacity_coefficient(int i){ throw NotImplementedError("calc_fugacity_coefficient is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_fugacity_coefficient(std::size_t i){ throw NotImplementedError("calc_fugacity_coefficient is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the fugacity in Pa
|
||||
virtual CoolPropDbl calc_fugacity(std::size_t i){ throw NotImplementedError("calc_fugacity is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the phase identification parameter (PIP)
|
||||
virtual CoolPropDbl calc_PIP(void){ throw NotImplementedError("calc_PIP is not implemented for this backend"); };
|
||||
|
||||
@@ -544,7 +546,10 @@ public:
|
||||
double isothermal_compressibility(void);
|
||||
/// Return the isobaric expansion coefficient \f$ \beta = \frac{1}{v}\left.\frac{\partial v}{\partial T}\right|_p = -\frac{1}{\rho}\left.\frac{\partial \rho}{\partial T}\right|_p\f$ in 1/K
|
||||
double isobaric_expansion_coefficient(void);
|
||||
double fugacity_coefficient(int i);
|
||||
/// Return the fugacity coefficient of the i-th component of the mixture
|
||||
double fugacity_coefficient(std::size_t i);
|
||||
/// Return the fugacity of the i-th component of the mixture
|
||||
double fugacity(std::size_t i);
|
||||
/// Return the fundamental derivative of gas dynamics
|
||||
//double fundamental_derivative_of_gas_dynamics(void){return this->second_partial_deriv(iP, iDmolar, iSmolar, iDmolar, iSmolar)/pow(speed_sound(), 2)/2/pow(this->rhomolar(),3);};
|
||||
/// Return the phase identification parameter (PIP) of G. Venkatarathnam and L.R. Oellrich, "Identification of the phase of a fluid using partial derivatives of pressure, volume, and temperature without reference to saturation properties: Applications in phase equilibria calculations"
|
||||
|
||||
@@ -169,6 +169,11 @@ bool is_valid_parameter(const std::string & name, parameters & iOutput);
|
||||
/// If it is a value derivative, the variables are set to the parts of the derivative
|
||||
bool is_valid_first_derivative(const std::string & name, parameters &iOf, parameters &iWrt, parameters &iConstant);
|
||||
|
||||
/// Returns true if the string corresponds to a valid first saturation derivative - e.g. "d(P)/d(T)|sigma" for instance
|
||||
///
|
||||
/// If it is a valid derivative, the variables are set to the parts of the derivative
|
||||
bool is_valid_first_saturation_derivative(const std::string & name, parameters &iOf, parameters &iWrt);
|
||||
|
||||
/// Returns true if the string corresponds to a valid second derivative
|
||||
///
|
||||
/// If it is a value derivative, the variables are set to the parts of the derivative
|
||||
|
||||
@@ -431,10 +431,14 @@ double AbstractState::gas_constant(void){
|
||||
if (!_gas_constant) _gas_constant = calc_gas_constant();
|
||||
return _gas_constant;
|
||||
}
|
||||
double AbstractState::fugacity_coefficient(int i){
|
||||
double AbstractState::fugacity_coefficient(std::size_t i){
|
||||
// TODO: Cache the fug. coeff for each component
|
||||
return calc_fugacity_coefficient(i);
|
||||
}
|
||||
double AbstractState::fugacity(std::size_t i){
|
||||
// TODO: Cache the fug. coeff for each component
|
||||
return calc_fugacity(i);
|
||||
}
|
||||
void AbstractState::build_phase_envelope(const std::string &type)
|
||||
{
|
||||
calc_phase_envelope(type);
|
||||
@@ -443,7 +447,7 @@ double AbstractState::isothermal_compressibility(void){
|
||||
return 1.0/_rhomolar*first_partial_deriv(iDmolar, iP, iT);
|
||||
}
|
||||
double AbstractState::isobaric_expansion_coefficient(void){
|
||||
return -1.0/pow(_rhomolar,2)*first_partial_deriv(iDmolar, iT, iP);
|
||||
return -1.0/_rhomolar*first_partial_deriv(iDmolar, iT, iP);
|
||||
}
|
||||
double AbstractState::Bvirial(void){ return calc_Bvirial(); }
|
||||
double AbstractState::Cvirial(void){ return calc_Cvirial(); }
|
||||
|
||||
@@ -2341,11 +2341,16 @@ CoolPropDbl HelmholtzEOSMixtureBackend::calc_gibbsmolar(void)
|
||||
throw ValueError(format("phase is invalid in calc_gibbsmolar"));
|
||||
}
|
||||
}
|
||||
CoolPropDbl HelmholtzEOSMixtureBackend::calc_fugacity_coefficient(int i)
|
||||
CoolPropDbl HelmholtzEOSMixtureBackend::calc_fugacity_coefficient(std::size_t i)
|
||||
{
|
||||
x_N_dependency_flag xN_flag = XN_DEPENDENT;
|
||||
return exp(MixtureDerivatives::ln_fugacity_coefficient(*this, i, xN_flag));
|
||||
}
|
||||
CoolPropDbl HelmholtzEOSMixtureBackend::calc_fugacity(std::size_t i)
|
||||
{
|
||||
x_N_dependency_flag xN_flag = XN_DEPENDENT;
|
||||
return MixtureDerivatives::fugacity_i(*this, i, xN_flag);
|
||||
}
|
||||
CoolPropDbl HelmholtzEOSMixtureBackend::calc_phase_identification_parameter(void)
|
||||
{
|
||||
return 2 - rhomolar()*(second_partial_deriv(iP, iDmolar, iT, iT, iDmolar)/first_partial_deriv(iP, iT, iDmolar) - second_partial_deriv(iP, iDmolar, iT, iDmolar, iT)/first_partial_deriv(iP, iDmolar, iT));
|
||||
|
||||
@@ -192,8 +192,11 @@ public:
|
||||
*
|
||||
*
|
||||
*/
|
||||
CoolPropDbl calc_fugacity_coefficient(int i);
|
||||
|
||||
|
||||
CoolPropDbl calc_phase_identification_parameter(void);
|
||||
CoolPropDbl calc_fugacity(std::size_t i);
|
||||
CoolPropDbl calc_fugacity_coefficient(std::size_t i);
|
||||
|
||||
/// Using this backend, calculate the flame hazard
|
||||
CoolPropDbl calc_flame_hazard(void){ return components[0].environment.FH;};
|
||||
|
||||
@@ -22,8 +22,10 @@ surface tension N/m
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#define REFPROP_IMPLEMENTATION
|
||||
#define REFPROP_CSTYLE_REFERENCES
|
||||
#include "REFPROP_lib.h"
|
||||
#undef REFPROP_IMPLEMENTATION
|
||||
#undef REFPROP_CSTYLE_REFERENCES
|
||||
|
||||
#include "CoolPropTools.h"
|
||||
#include "REFPROPMixtureBackend.h"
|
||||
@@ -584,7 +586,7 @@ CoolPropDbl REFPROPMixtureBackend::calc_surface_tension(void)
|
||||
_surface_tension = sigma;
|
||||
return static_cast<double>(_surface_tension);
|
||||
}
|
||||
CoolPropDbl REFPROPMixtureBackend::calc_fugacity_coefficient(int i)
|
||||
CoolPropDbl REFPROPMixtureBackend::calc_fugacity_coefficient(std::size_t i)
|
||||
{
|
||||
this->check_loaded_fluid();
|
||||
double rho_mol_L = 0.001*_rhomolar;
|
||||
@@ -593,12 +595,26 @@ CoolPropDbl REFPROPMixtureBackend::calc_fugacity_coefficient(int i)
|
||||
fug_cof.resize(mole_fractions.size());
|
||||
char herr[255];
|
||||
FUGCOFdll(&_T, &rho_mol_L, &(mole_fractions[0]), // Inputs
|
||||
&(fug_cof[0]), // Outputs
|
||||
&ierr, herr, errormessagelength); // Error message
|
||||
&(fug_cof[0]), // Outputs
|
||||
&ierr, herr, errormessagelength); // Error message
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
//else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return static_cast<CoolPropDbl>(fug_cof[i]);
|
||||
}
|
||||
CoolPropDbl REFPROPMixtureBackend::calc_fugacity(std::size_t i)
|
||||
{
|
||||
this->check_loaded_fluid();
|
||||
double rho_mol_L = 0.001*_rhomolar;
|
||||
long ierr = 0;
|
||||
std::vector<double> f(mole_fractions.size());
|
||||
char herr[255];
|
||||
FGCTY2dll(&_T, &rho_mol_L, &(mole_fractions[0]), // Inputs
|
||||
&(f[0]), // Outputs
|
||||
&ierr, herr, errormessagelength); // Error message
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s", herr).c_str()); }
|
||||
//else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return static_cast<CoolPropDbl>(f[i]*1000);
|
||||
}
|
||||
|
||||
void REFPROPMixtureBackend::calc_phase_envelope(const std::string &type)
|
||||
{
|
||||
|
||||
@@ -130,7 +130,8 @@ public:
|
||||
/// Calc the C virial coefficient
|
||||
CoolPropDbl calc_Cvirial(void);
|
||||
|
||||
CoolPropDbl calc_fugacity_coefficient(int i);
|
||||
CoolPropDbl calc_fugacity_coefficient(std::size_t i);
|
||||
CoolPropDbl calc_fugacity(std::size_t i);
|
||||
CoolPropDbl calc_melting_line(int param, int given, CoolPropDbl value);
|
||||
bool has_melting_line(){return true;};
|
||||
double calc_melt_Tmax();
|
||||
|
||||
@@ -278,11 +278,12 @@ void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double v
|
||||
std::vector<std::pair<std::size_t, std::size_t> > intersect = PhaseEnvelopeRoutines::find_intersections(phase_envelope, iP, _p);
|
||||
if (intersect.empty()){ throw ValueError(format("p [%g Pa] is not within phase envelope", _p)); }
|
||||
iV = intersect[0].first; iL = intersect[1].first;
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
else{
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
CoolPropDbl zL, zV;
|
||||
pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, zL, zV);
|
||||
}
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -305,7 +306,8 @@ void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double v
|
||||
_p = _Q*pV + (1-_Q)*pL;
|
||||
}
|
||||
else{
|
||||
_p = pure_saturation.evaluate(iP, _T, _Q, iL, iV);
|
||||
CoolPropDbl zL, zV;
|
||||
pure_saturation.is_inside(iT, _T, iQ, _Q, iL, iV, zL, zV);
|
||||
}
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
|
||||
@@ -180,34 +180,54 @@ void CoolProp::TTSEBackend::update(CoolProp::input_pairs input_pair, double val1
|
||||
break;
|
||||
}
|
||||
case PQ_INPUTS:{
|
||||
std::size_t iL = 0, iV = 0;
|
||||
CoolPropDbl dummyL = 0, dummyV = 0;
|
||||
_p = val1; _Q = val2;
|
||||
pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, dummyL, dummyV);
|
||||
std::size_t iL = 0, iV = 0;
|
||||
CoolPropDbl hL = 0, hV = 0;
|
||||
_p = val1; _Q = val2;
|
||||
|
||||
using_single_phase_table = false;
|
||||
if(!is_in_closed_range(0.0, 1.0, static_cast<double>(_Q))){
|
||||
if (!is_in_closed_range(0.0, 1.0, static_cast<double>(_Q))){
|
||||
throw ValueError("vapor quality is not in (0,1)");
|
||||
}
|
||||
else{
|
||||
if (is_mixture){
|
||||
std::vector<std::pair<std::size_t, std::size_t> > intersect = PhaseEnvelopeRoutines::find_intersections(phase_envelope, iP, _p);
|
||||
if (intersect.empty()){ throw ValueError(format("p [%g Pa] is not within phase envelope", _p)); }
|
||||
iV = intersect[0].first; iL = intersect[1].first;
|
||||
}
|
||||
else{
|
||||
CoolPropDbl zL, zV;
|
||||
pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, zL, zV);
|
||||
}
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QT_INPUTS:{
|
||||
std::size_t iL = 0, iV = 0;
|
||||
CoolPropDbl dummyL = 0, dummyV = 0;
|
||||
_Q = val1; _T = val2;
|
||||
pure_saturation.is_inside(iT, _T, iQ, _Q, iL, iV, dummyL, dummyV);
|
||||
std::size_t iL = 0, iV = 0;
|
||||
CoolPropDbl dummyL = 0, dummyV = 0;
|
||||
_Q = val1; _T = val2;
|
||||
|
||||
using_single_phase_table = false;
|
||||
if(!is_in_closed_range(0.0, 1.0, static_cast<double>(_Q))){
|
||||
if (!is_in_closed_range(0.0, 1.0, static_cast<double>(_Q))){
|
||||
throw ValueError("vapor quality is not in (0,1)");
|
||||
}
|
||||
else{
|
||||
_p = pure_saturation.evaluate(iP, _T, _Q, iL, iV);
|
||||
if (is_mixture){
|
||||
std::vector<std::pair<std::size_t, std::size_t> > intersect = PhaseEnvelopeRoutines::find_intersections(phase_envelope, iT, _T);
|
||||
if (intersect.empty()){ throw ValueError(format("T [%g K] is not within phase envelope", _T)); }
|
||||
iV = intersect[0].first; iL = intersect[1].first;
|
||||
double pL = PhaseEnvelopeRoutines::evaluate(phase_envelope, iP, iT, _T, iL);
|
||||
double pV = PhaseEnvelopeRoutines::evaluate(phase_envelope, iP, iT, _T, iV);
|
||||
_p = _Q*pV + (1-_Q)*pL;
|
||||
}
|
||||
else{
|
||||
CoolPropDbl zL, zV;
|
||||
pure_saturation.is_inside(iT, _T, iQ, _Q, iL, iV, zL, zV);
|
||||
}
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw ValueError("Sorry, but this set of inputs is not supported for TTSE backend");
|
||||
}
|
||||
|
||||
@@ -847,6 +847,20 @@ TEST_CASE_METHOD(TabularFixture, "Tests for tabular backends with water", "[Tabu
|
||||
CHECK(std::abs((expected-actual_TTSE)/expected) < 1e-6);
|
||||
CHECK(std::abs((expected-actual_BICUBIC)/expected) < 1e-6);
|
||||
}
|
||||
SECTION("first_saturation_deriv dHmass/dP w/ QT as inputs"){
|
||||
setup();
|
||||
ASHEOS->update(CoolProp::QT_INPUTS, 1, 370);
|
||||
CoolPropDbl expected = ASHEOS->first_saturation_deriv(CoolProp::iHmass, CoolProp::iP);
|
||||
ASTTSE->update(CoolProp::QT_INPUTS, 1, 370);
|
||||
CoolPropDbl actual_TTSE = ASTTSE->first_saturation_deriv(CoolProp::iHmass, CoolProp::iP);
|
||||
ASBICUBIC->update(CoolProp::QT_INPUTS, 1, 370);
|
||||
CoolPropDbl actual_BICUBIC = ASBICUBIC->first_saturation_deriv(CoolProp::iHmass, CoolProp::iP);
|
||||
CAPTURE(expected);
|
||||
CAPTURE(actual_TTSE);
|
||||
CAPTURE(actual_BICUBIC);
|
||||
CHECK(std::abs((expected-actual_TTSE)/expected) < 1e-6);
|
||||
CHECK(std::abs((expected-actual_BICUBIC)/expected) < 1e-6);
|
||||
}
|
||||
SECTION("first_two_phase_deriv dDmolar/dP|Hmolar"){
|
||||
setup();
|
||||
ASHEOS->update(CoolProp::PQ_INPUTS, 101325, 0.1);
|
||||
|
||||
@@ -732,6 +732,7 @@ class TabularBackend : public AbstractState
|
||||
CoolPropDbl calc_p_triple(void){return this->AS->p_triple();};
|
||||
CoolPropDbl calc_pmax(void){return this->AS->pmax();};
|
||||
CoolPropDbl calc_Tmax(void){return this->AS->Tmax();};
|
||||
CoolPropDbl calc_p_critical(void){ return this->AS->p_critical(); }
|
||||
bool using_mole_fractions(void){return true;}
|
||||
bool using_mass_fractions(void){return false;}
|
||||
bool using_volu_fractions(void){return false;}
|
||||
|
||||
@@ -242,7 +242,7 @@ void _PropsSI_initialize(const std::string &backend,
|
||||
}
|
||||
|
||||
struct output_parameter{
|
||||
enum OutputParametersType {OUTPUT_TYPE_UNSET = 0, OUTPUT_TYPE_TRIVIAL, OUTPUT_TYPE_NORMAL, OUTPUT_TYPE_FIRST_DERIVATIVE, OUTPUT_TYPE_SECOND_DERIVATIVE};
|
||||
enum OutputParametersType {OUTPUT_TYPE_UNSET = 0, OUTPUT_TYPE_TRIVIAL, OUTPUT_TYPE_NORMAL, OUTPUT_TYPE_FIRST_DERIVATIVE, OUTPUT_TYPE_FIRST_SATURATION_DERIVATIVE, OUTPUT_TYPE_SECOND_DERIVATIVE};
|
||||
CoolProp::parameters Of1, Wrt1, Constant1, Wrt2, Constant2;
|
||||
OutputParametersType type;
|
||||
/// Parse a '&' separated string into a data structure with one entry per output
|
||||
@@ -257,6 +257,9 @@ struct output_parameter{
|
||||
if (is_trivial_parameter(iOutput)){ out.type = OUTPUT_TYPE_TRIVIAL; }
|
||||
else{ out.type = OUTPUT_TYPE_NORMAL; }
|
||||
}
|
||||
else if (is_valid_first_saturation_derivative(*str, out.Of1, out.Wrt1)){
|
||||
out.type = OUTPUT_TYPE_FIRST_SATURATION_DERIVATIVE;
|
||||
}
|
||||
else if (is_valid_first_derivative(*str, out.Of1, out.Wrt1, out.Constant1)){
|
||||
out.type = OUTPUT_TYPE_FIRST_DERIVATIVE;
|
||||
}
|
||||
@@ -364,6 +367,8 @@ void _PropsSI_outputs(shared_ptr<AbstractState> &State,
|
||||
IO[i][j] = State->keyed_output(output.Of1); break;
|
||||
case output_parameter::OUTPUT_TYPE_FIRST_DERIVATIVE:
|
||||
IO[i][j] = State->first_partial_deriv(output.Of1, output.Wrt1, output.Constant1); break;
|
||||
case output_parameter::OUTPUT_TYPE_FIRST_SATURATION_DERIVATIVE:
|
||||
IO[i][j] = State->first_saturation_deriv(output.Of1, output.Wrt1); break;
|
||||
case output_parameter::OUTPUT_TYPE_SECOND_DERIVATIVE:
|
||||
IO[i][j] = State->second_partial_deriv(output.Of1, output.Wrt1, output.Constant1, output.Wrt2, output.Constant2); break;
|
||||
default:
|
||||
@@ -510,6 +515,9 @@ TEST_CASE("Check inputs to PropsSI","[PropsSI]")
|
||||
SECTION("Single state, single output"){
|
||||
CHECK(ValidNumber(CoolProp::PropsSI("T","P",101325,"Q",0,"Water")));
|
||||
};
|
||||
SECTION("Single state, single output, saturation derivative"){
|
||||
CHECK(ValidNumber(CoolProp::PropsSI("d(P)/d(T)|sigma","P",101325,"Q",0,"Water")));
|
||||
};
|
||||
SECTION("Single state, single output, pure incompressible"){
|
||||
CHECK(ValidNumber(CoolProp::PropsSI("D","P",101325,"T",300,"INCOMP::DowQ")));
|
||||
};
|
||||
|
||||
@@ -253,6 +253,38 @@ bool is_valid_first_derivative(const std::string &name, parameters &iOf, paramet
|
||||
}
|
||||
}
|
||||
|
||||
bool is_valid_first_saturation_derivative(const std::string &name, parameters &iOf, parameters &iWrt)
|
||||
{
|
||||
if (get_debug_level() > 5){ std::cout << format("is_valid_first_saturation_derivative(%s)", name.c_str()); }
|
||||
// There should be exactly one /
|
||||
// There should be exactly one |
|
||||
|
||||
// Suppose we start with "d(P)/d(T)|sigma"
|
||||
std::vector<std::string> split_at_bar = strsplit(name, '|'); // "d(P)/d(T)" and "sigma"
|
||||
if (split_at_bar.size() != 2){ return false; }
|
||||
|
||||
std::vector<std::string> split_at_slash = strsplit(split_at_bar[0], '/'); // "d(P)" and "d(T)"
|
||||
if (split_at_slash.size() != 2){ return false; }
|
||||
|
||||
std::size_t i0 = split_at_slash[0].find("(");
|
||||
std::size_t i1 = split_at_slash[0].find(")", i0);
|
||||
if (!((i0 > 0) && (i0 != std::string::npos) && (i1 > (i0+1)) && (i1 != std::string::npos))){ return false; }
|
||||
std::string num = split_at_slash[0].substr(i0+1, i1-i0-1);
|
||||
|
||||
i0 = split_at_slash[1].find("(");
|
||||
i1 = split_at_slash[1].find(")", i0);
|
||||
if (!((i0 > 0) && (i0 != std::string::npos) && (i1 > (i0+1)) && (i1 != std::string::npos))){ return false; }
|
||||
std::string den = split_at_slash[1].substr(i0+1, i1-i0-1);
|
||||
|
||||
parameters Of, Wrt, Constant;
|
||||
if (is_valid_parameter(num, Of) && is_valid_parameter(den, Wrt) && upper(split_at_bar[1]) == "SIGMA"){
|
||||
iOf = Of; iWrt = Wrt; return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_valid_second_derivative(const std::string &name, parameters &iOf1, parameters &iWrt1, parameters &iConstant1, parameters &iWrt2, parameters &iConstant2)
|
||||
{
|
||||
if (get_debug_level() > 5){std::cout << format("is_valid_second_derivative(%s)",name.c_str());}
|
||||
|
||||
@@ -68,6 +68,10 @@ cdef class AbstractState:
|
||||
cpdef double Bvirial(self) except *
|
||||
cpdef double Cvirial(self) except *
|
||||
cpdef double PIP(self) except *
|
||||
cpdef double isothermal_compressibility(self) except *
|
||||
cpdef double isobaric_expansion_coefficient(self) except *
|
||||
cpdef double fugacity(self, size_t) except *
|
||||
cpdef double fugacity_coefficient(self, size_t) except *
|
||||
|
||||
cpdef double molar_mass(self) except *
|
||||
cpdef double acentric_factor(self) except*
|
||||
|
||||
@@ -182,6 +182,18 @@ cdef class AbstractState:
|
||||
cpdef double PIP(self) except *:
|
||||
""" Get the phase identification parameter - wrapper of c++ function :cpapi:`CoolProp::AbstractState::PIP(void)` """
|
||||
return self.thisptr.PIP()
|
||||
cpdef double isobaric_expansion_coefficient(self) except *:
|
||||
""" Get the isobaric expansion coefficient - wrapper of c++ function :cpapi:`CoolProp::AbstractState::isobaric_expansion_coefficient(void)` """
|
||||
return self.thisptr.isobaric_expansion_coefficient()
|
||||
cpdef double isothermal_compressibility(self) except *:
|
||||
""" Get the isothermal_compressibility - wrapper of c++ function :cpapi:`CoolProp::AbstractState::isothermal_compressibility(void)` """
|
||||
return self.thisptr.isothermal_compressibility()
|
||||
cpdef double fugacity(self, size_t i) except *:
|
||||
""" Get the fugacity of the i-th component - wrapper of c++ function :cpapi:`CoolProp::AbstractState::fugacity(std::size_t)` """
|
||||
return self.thisptr.fugacity(i)
|
||||
cpdef double fugacity_coefficient(self, size_t i) except *:
|
||||
""" Get the fugacity coefficient of the i-th component - wrapper of c++ function :cpapi:`CoolProp::AbstractState::fugacity_coefficient(std::size_t)` """
|
||||
return self.thisptr.fugacity_coefficient(i)
|
||||
|
||||
cpdef mole_fractions_liquid(self):
|
||||
""" Get the mole fractions of the liquid phase - wrapper of c++ function :cpapi:`CoolProp::AbstractState::mole_fractions_liquid(void)` """
|
||||
|
||||
@@ -486,7 +486,7 @@ cdef class State:
|
||||
----------
|
||||
Fluid : string
|
||||
StateDict : dictionary
|
||||
The state of the fluid - passed to the update function
|
||||
The state of the fluid - passed to the update function; if None, does not do a state update
|
||||
phase : string
|
||||
DEPRECATED : this input is ignored
|
||||
backend : string
|
||||
@@ -506,7 +506,8 @@ cdef class State:
|
||||
self.Fluid = _Fluid
|
||||
|
||||
# Parse the inputs provided
|
||||
self.update(StateDict)
|
||||
if StateDict is not None:
|
||||
self.update(StateDict)
|
||||
|
||||
self.phase = phase
|
||||
if phase is None:
|
||||
@@ -739,10 +740,22 @@ cdef class State:
|
||||
|
||||
Returns ``None`` if pressure is not within the two-phase pressure range
|
||||
"""
|
||||
if self.p_ > 0.001*_PropsSI('pcrit','T',0,'P',0,self.Fluid) or self.p_ < 0.001*_PropsSI('ptriple','T',0,'P',0, self.Fluid):
|
||||
return None
|
||||
cdef State state = State(self.Fluid, None)
|
||||
cdef double pc = state.Props(iP_critical)
|
||||
cdef double pt
|
||||
try:
|
||||
pt = state.Props(iP_triple)
|
||||
except ValueError:
|
||||
pt = -1
|
||||
if _ValidNumber(pc) and _ValidNumber(pt):
|
||||
if self.p_ > 0.001*pc or self.p_ < 0.001*pt:
|
||||
return None
|
||||
else:
|
||||
state.update(dict(P=self.p_,Q=Q))
|
||||
return state.T
|
||||
else:
|
||||
return 0.001*_PropsSI('T', 'P', self.p_*1000, 'Q', Q, self.Fluid)
|
||||
state.update(dict(P=self.p_,Q=Q))
|
||||
return state.T
|
||||
property Tsat:
|
||||
""" The saturation temperature (dew) for the given pressure, in [K]"""
|
||||
def __get__(self):
|
||||
|
||||
@@ -85,6 +85,10 @@ cdef extern from "AbstractState.h" namespace "CoolProp":
|
||||
double Bvirial() except +ValueError
|
||||
double Cvirial() except +ValueError
|
||||
double PIP() except +ValueError
|
||||
double isothermal_compressibility() except +ValueError
|
||||
double isobaric_expansion_coefficient() except +ValueError
|
||||
double fugacity(size_t) except +ValueError
|
||||
double fugacity_coefficient(size_t) except +ValueError
|
||||
|
||||
double keyed_output(constants_header.parameters) except+ValueError
|
||||
double trivial_keyed_output(constants_header.parameters) except+ValueError
|
||||
|
||||
235
wrappers/Python/generate_meta.yaml.py
Normal file
235
wrappers/Python/generate_meta.yaml.py
Normal file
@@ -0,0 +1,235 @@
|
||||
import jinja2
|
||||
from jinja2 import Environment
|
||||
import os,sys
|
||||
import requests
|
||||
import json
|
||||
from distutils.version import LooseVersion #, StrictVersion
|
||||
import codecs
|
||||
|
||||
""" A simple script to create a conda recipe from the PyPI release and build the package"""
|
||||
|
||||
template = """
|
||||
package:
|
||||
name: coolprop
|
||||
version: {{ version }}
|
||||
|
||||
{% if pypi %}
|
||||
source:
|
||||
fn: {{ fil }}
|
||||
url: {{ url }}
|
||||
md5: {{ md5 }}
|
||||
{% endif %}
|
||||
|
||||
{% if local %}
|
||||
source:
|
||||
path: .
|
||||
{% endif %}
|
||||
|
||||
|
||||
# If this is a new build for the same version, increment the build
|
||||
# number. If you do not include this key, it defaults to 0.
|
||||
# number: 1
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- setuptools{% for pkg in pkgs %}
|
||||
- {{ pkg -}}
|
||||
{% endfor %}
|
||||
|
||||
run:
|
||||
- python{% for pkg in pkgs %}
|
||||
- {{ pkg -}}
|
||||
{% endfor %}
|
||||
|
||||
#test:
|
||||
# # Python imports
|
||||
# imports:
|
||||
# - CoolProp
|
||||
# #- CoolProp.GUI
|
||||
# #- CoolProp.Plots
|
||||
# - CoolProp.tests
|
||||
|
||||
# commands:
|
||||
# You can put test commands to be run here. Use this to test that the
|
||||
# entry points work.
|
||||
|
||||
|
||||
# You can also put a file called run_test.py in the recipe that will be run
|
||||
# at test time.
|
||||
|
||||
# requires:
|
||||
# Put any additional test requirements here. For example
|
||||
# - nose
|
||||
|
||||
about:
|
||||
home: {{ home }}
|
||||
license: {{ license }}
|
||||
summary: {{ summary }}
|
||||
|
||||
"""
|
||||
|
||||
target_dir = os.path.join(os.path.dirname(__file__),'..','..')
|
||||
|
||||
#loader = jinja2.FileSystemLoader(template_dir)
|
||||
#environment = jinja2.Environment(loader=loader)
|
||||
#template = environment.get_template(os.path.join(template_dir,'conda_'+target+'.tpl'))
|
||||
#
|
||||
template =Environment().from_string(template)
|
||||
|
||||
|
||||
pypi = False
|
||||
local = not pypi
|
||||
|
||||
pkgs = ["numpy", "scipy", "matplotlib", "pandas", "cython"]
|
||||
target = 'meta.yaml'
|
||||
|
||||
if pypi:
|
||||
# Get the additional information from PyPI
|
||||
r = requests.get('https://pypi.python.org/pypi/CoolProp/json')
|
||||
if(r.ok):
|
||||
item = json.loads(r.text or r.content)
|
||||
version = item['info']['version']
|
||||
#version = sorted(item['releases'].keys())[-1]
|
||||
home = item['info']['home_page']
|
||||
license = 'MIT'
|
||||
summary = item['info']['summary']
|
||||
|
||||
for u in item['urls']:
|
||||
if u['python_version'] != 'source': continue
|
||||
fil = u['filename']
|
||||
url = u['url']
|
||||
md5 = u['md5_digest']
|
||||
continue
|
||||
|
||||
|
||||
|
||||
if local:
|
||||
coolprop_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','..'))
|
||||
sys.path.append(os.path.join(coolprop_dir, 'dev'))
|
||||
import generate_headers
|
||||
# Generate the headers - does nothing if up to date - but only if not pypi
|
||||
generate_headers.generate()
|
||||
del generate_headers
|
||||
version = open(os.path.join(coolprop_dir,'.version'),'r').read().strip()
|
||||
home = "http://www.coolprop.org"
|
||||
license = "MIT"
|
||||
summary = "Open-source thermodynamic and transport properties database"
|
||||
fil = None
|
||||
url = None
|
||||
md5 = None
|
||||
|
||||
|
||||
|
||||
|
||||
f = codecs.open(os.path.join(target_dir,target),mode='wb',encoding='utf-8')
|
||||
f.write(template.render(
|
||||
pypi=pypi,
|
||||
local=local,
|
||||
version=version,
|
||||
fil=fil,
|
||||
url=url,
|
||||
md5=md5,
|
||||
pkgs=pkgs,
|
||||
home = home,
|
||||
license = license,
|
||||
summary = summary
|
||||
))
|
||||
f.close()
|
||||
|
||||
bat_template = """
|
||||
pushd wrappers\Python
|
||||
"%PYTHON%" setup.py install
|
||||
if errorlevel 1 exit 1
|
||||
popd
|
||||
|
||||
:: Add more build steps here, if they are necessary.
|
||||
|
||||
:: See
|
||||
:: http://docs.continuum.io/conda/build.html
|
||||
:: for a list of environment variables that are set during the build process.
|
||||
"""
|
||||
target = "bld.bat"
|
||||
f = codecs.open(os.path.join(target_dir,target),mode='wb',encoding='utf-8')
|
||||
f.write(bat_template)
|
||||
f.close()
|
||||
|
||||
bsh_template = """
|
||||
#!/bin/bash
|
||||
pushd wrappers/Python
|
||||
$PYTHON setup.py install
|
||||
popd
|
||||
|
||||
# Add more build steps here, if they are necessary.
|
||||
|
||||
# See
|
||||
# http://docs.continuum.io/conda/build.html
|
||||
# for a list of environment variables that are set during the build process.
|
||||
"""
|
||||
target = "build.sh"
|
||||
f = codecs.open(os.path.join(target_dir,target),mode='wb',encoding='utf-8')
|
||||
f.write(bsh_template)
|
||||
f.close()
|
||||
|
||||
runner_template = """
|
||||
from __future__ import print_function
|
||||
import sys, shutil, subprocess, os, stat
|
||||
def run_command(cmd):
|
||||
'''given shell command, returns communication tuple of stdout and stderr'''
|
||||
return subprocess.Popen(cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
stdin=subprocess.PIPE).communicate()
|
||||
def remove_all(path):
|
||||
#subprocess.check_call(['cmd', '/c', 'rd', '/s', '/q', path])
|
||||
print(run_command(['cmd', '/c', 'rd', '/s', '/q', path])[0].decode("utf-8"))
|
||||
def remove_readonly(func, path, _):
|
||||
"Clear the readonly bit and reattempt the removal"
|
||||
os.chmod(path, stat.S_IWRITE)
|
||||
try: func(path)
|
||||
except: remove_all(path); pass
|
||||
#
|
||||
#cmd = ['conda','remove','--all','-yq','-n']
|
||||
#for t in ['_test','_build']:
|
||||
# try:
|
||||
# subprocess.check_call(cmd+[t], stdout=sys.stdout, stderr=sys.stderr)
|
||||
# except:
|
||||
# envs = run_command(['conda','env','list'])[0].decode("utf-8").splitlines()
|
||||
# for env in envs:
|
||||
# lst = env.split(' ')
|
||||
# if len(lst)>0 and lst[0] == t:
|
||||
# dir = ' '.join(lst[1:]).strip()
|
||||
# print("Manually removing: "+dir)
|
||||
# shutil.rmtree(dir, onerror=remove_readonly)
|
||||
# pass
|
||||
tar = os.path.abspath(os.path.join(os.path.dirname(__file__),'install_root')).strip()
|
||||
#if os.path.isdir(tar): shutil.rmtree(tar, onerror=remove_readonly)
|
||||
ver = sys.version_info
|
||||
cmd = ['conda','build','--python',str(ver[0])+'.'+str(ver[1])]
|
||||
print('Command is: '+' '.join(cmd))
|
||||
print(run_command(['conda', 'clean', '-y', '-lts'])[0].decode("utf-8").strip())
|
||||
filename = os.path.abspath(run_command(cmd+['--output','.'])[0].decode("utf-8").strip())
|
||||
tar = os.path.join(tar,'Python_conda',os.path.basename(os.path.dirname(filename))).strip()
|
||||
try:
|
||||
subprocess.check_call(cmd+['.'], stdout=sys.stdout, stderr=sys.stderr)
|
||||
except Exception as e:
|
||||
print("conda build failed: "+str(e))
|
||||
pass
|
||||
try:
|
||||
os.makedirs(tar)
|
||||
except Exception as e:
|
||||
if os.path.isdir(tar): pass
|
||||
else: raise
|
||||
try:
|
||||
print("Copying: "+str(filename)+" to "+str(tar))
|
||||
shutil.copy(filename,tar)
|
||||
except Exception as e:
|
||||
print("Copy operation failed: "+str(e))
|
||||
pass
|
||||
sys.exit(0)
|
||||
"""
|
||||
target = "runner.py"
|
||||
f = codecs.open(os.path.join(target_dir,target),mode='wb',encoding='utf-8')
|
||||
f.write(runner_template)
|
||||
f.close()
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user