├── .gitignore ├── README.md └── diffpy-cmi ├── LICENSE.txt ├── README.txt ├── diffpy_cmi.pth ├── install ├── makedist ├── runtests.sh └── src-addons ├── diffpy.srreal └── sconscript.local ├── libdiffpy └── sconscript.local ├── libobjcryst └── sconscript.local └── pyobjcryst └── sconscript.local /.gitignore: -------------------------------------------------------------------------------- 1 | /diffpy-cmi/bin/ 2 | /diffpy-cmi/include/ 3 | /diffpy-cmi/lib/ 4 | /diffpy-cmi/share/ 5 | /diffpy-cmi/src/ 6 | /diffpy-cmi/dist/ 7 | /diffpy-cmi/.license.agreed 8 | /diffpy-cmi/VERSION.txt 9 | *.swp 10 | .project 11 | .pydevproject 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | diffpy-release 2 | ============== 3 | 4 | Scripts for producing binary release bundle for assorted 5 | flavors of Linux and Mac. 6 | -------------------------------------------------------------------------------- /diffpy-cmi/LICENSE.txt: -------------------------------------------------------------------------------- 1 | OPEN SOURCE LICENSE AGREEMENT 2 | ============================= 3 | 4 | Copyright (c) 2009-2011, University of Tennessee 5 | Copyright (c) 1989, 1991 Free Software Foundation, Inc. 6 | Copyright (c) 2006, The Regents of the University of California through 7 | Lawrence Berkeley National Laboratory 8 | Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") 9 | Copyright (c) 2006-2007, Board of Trustees of Michigan State University 10 | Copyright (c) 2008-2012, The Trustees of Columbia University in the City 11 | of New York 12 | 13 | Copyright (c) 2014-2016, Brookhaven Science Associates, Brookhaven National 14 | Laboratory 15 | 16 | 17 | The "DiffPy-CMI" is distributed subject to the following license conditions: 18 | 19 | 20 | SOFTWARE LICENSE AGREEMENT 21 | 22 | Software: DiffPy-CMI 23 | 24 | 25 | (1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either 26 | source code, or binary form and accompanying documentation). 27 | 28 | Part of the software was derived from the DANSE, ObjCryst++ (with permission), 29 | PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of 30 | which the original Copyrights are contained in each individual file. 31 | 32 | Each licensee is addressed as "you" or "Licensee." 33 | 34 | 35 | (2) The copyright holders shown above and their third-party Licensors hereby 36 | grant licensee a royalty-free nonexclusive license, subject to the limitations 37 | stated herein and U.S. Government license rights. 38 | 39 | 40 | (3) You may modify and make a copy or copies of the software for use within 41 | your organization, if you meet the following conditions: 42 | 43 | (a) Copies in source code must include the copyright notice and this 44 | software license agreement. 45 | 46 | (b) Copies in binary form must include the copyright notice and this 47 | Software License Agreement in the documentation and/or other materials 48 | provided with the copy. 49 | 50 | 51 | (4) You may modify a copy or copies of the Software or any portion of it, thus 52 | forming a work based on the Software, and distribute copies of such work 53 | outside your organization, if you meet all of the following conditions: 54 | 55 | (a) Copies in source code must include the copyright notice and this 56 | Software License Agreement; 57 | 58 | (b) Copies in binary form must include the copyright notice and this 59 | Software License Agreement in the documentation and/or other materials 60 | provided with the copy; 61 | 62 | (c) Modified copies and works based on the Software must carry prominent 63 | notices stating that you changed specified portions of the Software. 64 | 65 | (d) Neither the name of Brookhaven Science Associates or Brookhaven 66 | National Laboratory nor the names of its contributors may be used to 67 | endorse or promote products derived from this software without specific 68 | written permission. 69 | 70 | 71 | (5) Portions of the Software resulted from work developed under a U.S. 72 | Government contract and are subject to the following license: 73 | The Government is granted for itself and others acting on its behalf a 74 | paid-up, nonexclusive, irrevocable worldwide license in this computer software 75 | to reproduce, prepare derivative works, and perform publicly and display 76 | publicly. 77 | 78 | 79 | (6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT 80 | WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY 81 | LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 82 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 83 | BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 84 | PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL 85 | LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF 86 | THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE 87 | PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 88 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. 89 | 90 | 91 | (7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR 92 | THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 93 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, 94 | CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING 95 | BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, 96 | WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING 97 | NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS 98 | BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. 99 | 100 | 101 | Brookhaven National Laboratory Notice 102 | ===================================== 103 | 104 | Acknowledgment of sponsorship 105 | ----------------------------- 106 | 107 | This software was produced by the Brookhaven National Laboratory, under 108 | Contract DE-AC02-98CH10886 with the Department of Energy. 109 | 110 | 111 | Government disclaimer of liability 112 | ---------------------------------- 113 | 114 | Neither the United States nor the United States Department of Energy, nor 115 | any of their employees, makes any warranty, express or implied, or assumes 116 | any legal liability or responsibility for the accuracy, completeness, or 117 | usefulness of any data, apparatus, product, or process disclosed, or 118 | represents that its use would not infringe privately owned rights. 119 | 120 | 121 | Brookhaven disclaimer of liability 122 | ---------------------------------- 123 | 124 | Brookhaven National Laboratory makes no representations or warranties, 125 | express or implied, nor assumes any liability for the use of this software. 126 | 127 | 128 | Maintenance of notice 129 | --------------------- 130 | 131 | In the interest of clarity regarding the origin and status of this 132 | software, Brookhaven National Laboratory requests that any recipient of it 133 | maintain this notice affixed to any distribution by the recipient that 134 | contains a copy or derivative of this software. 135 | 136 | 137 | END OF LICENSE 138 | -------------------------------------------------------------------------------- /diffpy-cmi/README.txt: -------------------------------------------------------------------------------- 1 | DIFFPY-CMI 2 | 3 | Software framework for complex modeling of structures from diffraction data 4 | 5 | This release includes Python and C++ modules developed by the DiffPy team 6 | and the required external software dependencies. 7 | 8 | Python Libraries: 9 | 10 | * diffpy.srfit -- setup, control and evaluation of multi-contribution fits. 11 | * diffpy.srreal -- calculators for pair-interaction quantities such as pair 12 | distribution function (PDF), bond lengths, and bond valence sums (BVS). 13 | * diffpy.Structure -- storage and manipulation of crystal structure data 14 | and space group symmetry utilities. 15 | * diffpy.utils -- shared utilities such as parsing of text data files. 16 | * pyobjcryst -- Python bindings to the ObjCryst++ Object-Oriented 17 | Crystallographic Library 18 | * PyCifRW -- support for CIF (Crystallographic Information Format) files 19 | * periodictable -- access to the periodic table of elements data in Python 20 | 21 | C++ Libraries: 22 | 23 | * libdiffpy -- calculation of PDF, BVS and other pair-interaction quantities. 24 | * libobjcryst -- ObjCryst++ Object-Oriented Crystallographic Library packaged 25 | for installation as a shared library. 26 | * CxxTest -- testing framework for C++ codes. 27 | 28 | 29 | REQUIREMENTS 30 | 31 | Linux or Mac OS X with the following packages from system software manager: 32 | 33 | (a) Ubuntu or Debian Linux: 34 | 35 | sudo apt-get install \ 36 | libgsl0-dev libboost-all-dev python-dev python-setuptools \ 37 | python-numpy python-scipy python-matplotlib python-lxml ipython \ 38 | build-essential scons git zsh 39 | 40 | (b) Fedora Linux: 41 | 42 | sudo yum install \ 43 | gsl-devel boost-devel python-devel python-setuptools \ 44 | numpy scipy python-matplotlib python-lxml python-ipython-notebook \ 45 | gcc-c++ scons git zsh 46 | 47 | (c) Mac OS X with MacPorts (this may run for a while): 48 | 49 | sudo port install \ 50 | python27 py27-setuptools py27-ipython py27-lxml \ 51 | gsl boost py27-numpy py27-scipy py27-matplotlib scons git-core 52 | 53 | sudo port select --set ipython ipython27 54 | sudo port select --set python python27 55 | 56 | Important: When done, adjust the shell environment so that MacPorts Python 57 | is the first in the PATH: 58 | 59 | export PATH=/opt/local/bin:${PATH} 60 | 61 | 62 | INSTALLATION 63 | 64 | Run "./install" in a terminal and follow the prompts. When completed, run 65 | "./runtests.sh" to verify the installation. 66 | 67 | If you prefer to install manually, create symbolic link to the diffpy_cmi.pth 68 | file in some Python directory that processes .pth files. Note it is essential 69 | to use the symbolic link, making a copy of the .pth file would not work. 70 | 71 | For a single-user installation the preferred pth directory can be found using 72 | 73 | python -c 'import site; print site.USER_SITE' 74 | 75 | whereas for a system-wide installation the standard pth locations are 76 | 77 | python -c 'import site; print site.getsitepackages()' 78 | 79 | 80 | UPGRADE 81 | 82 | DiffPy source packages included in this distribution can be updated to 83 | the latest versions from online source repositories by running 84 | 85 | ./install --update[=steps] 86 | 87 | where the optional steps allow to do updates only for some rather 88 | than all source codes. Use "./install -n --update" to display the 89 | list of steps without making any changes. 90 | 91 | The updated sources need to be re-compiled and activated using 92 | 93 | ./install --build[=steps] 94 | 95 | Similarly as for the update action, "./install -n --build" displays 96 | the build steps without performing them. Finally, use "./install --help" 97 | for a short summary of all options for the install script. 98 | 99 | 100 | CONTACTS 101 | 102 | If you need help with installing this software, please check discussions 103 | or post your question at https://groups.google.com/d/forum/diffpy-dev. 104 | 105 | For more information on DiffPy-CMI please visit the project web-page 106 | 107 | http://www.diffpy.org 108 | 109 | or email Prof. Simon Billinge at sb2896@columbia.edu. 110 | -------------------------------------------------------------------------------- /diffpy-cmi/diffpy_cmi.pth: -------------------------------------------------------------------------------- 1 | # This file should be symlinked to the site.USER_SITE directory or some 2 | # other Python directory that processes .pth files. 3 | import sys, os, site; site.addsitedir(os.path.join(os.path.dirname(os.path.realpath(fullname)), 'lib/python%i.%i/site-packages' % sys.version_info[:2])) 4 | -------------------------------------------------------------------------------- /diffpy-cmi/install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # vim: ft=zsh 3 | 4 | DOC=" 5 | DiffPy-CMI installation utility 6 | usage: ./install [options] 7 | 8 | Options: 9 | 10 | -n, --dry-run list what would be done without making any changes. 11 | Display a list of steps when run with --update, --build 12 | or --clean. 13 | 14 | --update[=steps] perform all or selected software updates from online 15 | source repositories. Update steps are comma separated 16 | integers or ranges such as '1,3,5-6'. Use option -n to 17 | display the steps. 18 | 19 | --build[=steps] rebuild all or specified packages from sources in the 20 | src folder. Use option -n to display the build steps. 21 | 22 | --clean[=steps] remove generated files from the source folders of the 23 | specified packages. This ensures that --build is run 24 | from a pristine state. 25 | 26 | -h, --help display this message and exit 27 | " 28 | 29 | # Environment overridable variables 30 | 31 | : ${PYTHON:=python} # python executable to install for 32 | : ${SCONS:=scons} # path to scons, the software building tool 33 | 34 | # Re-launch using zsh -------------------------------------------------------- 35 | 36 | if test -z "$ZSH_VERSION"; then 37 | ZSH=/bin/zsh 38 | if ! test -x "$ZSH"; then 39 | ZSH=zsh 40 | fi 41 | if ! type "$ZSH" >/dev/null 2>&1; then 42 | echo "This script requires Z shell. Please install zsh using either of" 43 | echo 44 | echo ' sudo apt-get install zsh' 45 | echo 46 | echo ' sudo yum install zsh' 47 | echo 48 | exit 2 49 | fi 50 | # Mac OS X 10.7 (Lion) is misconfigured to reset PATH for "zsh -f" 51 | # Save the original value so it can be restored in zsh. 52 | export PATH_NwldpJ="$PATH" 53 | exec $ZSH -f "$0" "$@" 54 | fi 55 | 56 | # running with zsh here 57 | 58 | emulate zsh 59 | umask 022 60 | setopt extendedglob 61 | 62 | # restore the saved PATH and remove any duplicate entries. 63 | PATH="${PATH_NwldpJ}:${PATH}" 64 | # remove blank and duplicate entries from the PATH 65 | typeset -U path 66 | path=( $path ) 67 | 68 | # Constants ------------------------------------------------------------------ 69 | 70 | DOC=${${DOC##[[:space:]]##}%%[[:space:]]##} 71 | 72 | BASEDIR=$(cd ${0:h} && pwd -P) 73 | SRCDIR=${BASEDIR}/src 74 | PTHFILE=${BASEDIR}/diffpy_cmi.pth 75 | VERSION=$(cd $BASEDIR && test -s VERSION.txt && to display the license." 162 | read -sk1 163 | more ${BASEDIR}/LICENSE.txt 164 | print 165 | print -- $HASHLINE 166 | read -q "?Do you agree with the license terms? (y/n) " 167 | print 168 | print -- $HASHLINE 169 | if [[ $REPLY != [yY] ]]; then 170 | exit 1 171 | fi 172 | touch ${BASEDIR}/.license.agreed 173 | } 174 | 175 | 176 | python_easy_install() { 177 | local eicode='if True: 178 | import sys 179 | from setuptools.command.easy_install import main 180 | sys.argv[0] = "easy_install" 181 | main() 182 | ' 183 | ${PYTHON} -c "$eicode" "$@" 184 | } 185 | 186 | 187 | adjust_build_environment() { 188 | # tie path variables to unique arrays of the lower-case name 189 | typeset -TUx CPATH cpath 190 | typeset -TUx CPLUS_INCLUDE_PATH cplus_include_path 191 | typeset -TUx LIBRARY_PATH library_path 192 | typeset -TUx LD_LIBRARY_PATH ld_library_path 193 | typeset -TUx PYTHONPATH pythonpath 194 | if [[ ${(L)OSTYPE} == darwin* ]]; then 195 | adjust_macosx_environment 196 | fi 197 | BINDIR=${BASEDIR}/bin 198 | INCLUDEDIR=${BASEDIR}/include 199 | LIBDIR=${BASEDIR}/lib 200 | PYTHON_VERSION=$($PYTHON -c \ 201 | 'import sys; print "%s.%s" % sys.version_info[:2]') 202 | PYTHONDIR=$LIBDIR/python${PYTHON_VERSION}/site-packages 203 | : ${NCPU:=$(${PYTHON} -c \ 204 | 'from multiprocessing import cpu_count; print min(4, cpu_count())')} 205 | cpath=( $BASEDIR/include $cpath ) 206 | library_path=( ${BASEDIR}/lib $library_path ) 207 | ld_library_path=( ${BASEDIR}/lib $ld_library_path ) 208 | pythonpath=( $PYTHONDIR $pythonpath ) 209 | } 210 | 211 | adjust_macosx_environment() { 212 | local compilerpaths 213 | compilerpaths=( ${(f)"$(${CXX:-c++} -E -x c++ - -v &1)"} ) 214 | compilerpaths=( ${(M)compilerpaths:#[ ]*} ) 215 | compilerpaths=( ${${compilerpaths##[[:blank:]]##}%%[[:blank:]]*} ) 216 | compilerpaths=( ${^compilerpaths}(N-/) ) 217 | local PORTDIR=${$(whence -p port):h:h} 218 | local cxxhasboost 219 | cxxhasboost=( ${^compilerpaths}/boost(N-/) ) 220 | if [[ -z $cxxhasboost && -d ${PORTDIR}/include/boost ]]; then 221 | print "WARNING: Adjusting CPATH to include MacPorts header files." 222 | cpath=( $PORTDIR/include $cpath ) 223 | print -r "CPATH=${(q)CPATH}" 224 | print 225 | local plib=${PORTDIR}/lib 226 | if [[ -d $plib && -z ${(M)library_path:#${plib}} ]]; then 227 | print "WARNING: Adjusting LIBRARY_PATH to include MacPorts libraries." 228 | library_path=( $plib $library_path ) 229 | print -r "LIBRARY_PATH=${(q)LIBRARY_PATH}" 230 | print 231 | fi 232 | fi 233 | } 234 | 235 | 236 | integer CIDX=0 237 | integer UIDX=0 238 | integer BIDX=0 239 | 240 | ListSkipOrDo() { 241 | local selection 242 | local idx 243 | typeset -gA didheader 244 | case $1 in 245 | (clean) 246 | idx=$(( ++CIDX )) 247 | selection=( $clean_selection ) 248 | ;; 249 | (build) 250 | idx=$(( ++BIDX )) 251 | selection=( $build_selection ) 252 | ;; 253 | (update) 254 | idx=$(( ++UIDX )) 255 | selection=( $update_selection ) 256 | ;; 257 | (*) 258 | print -u2 "Invalid argument $1" 259 | exit 2 260 | esac 261 | local name=${2?} 262 | if [[ -z ${(M)selection:#${idx}} ]]; then 263 | return 0 264 | fi 265 | if [[ -n ${opt_dryrun} ]]; then 266 | if [[ -z ${didheader[$1]} ]]; then 267 | didheader[$1]=1 268 | print "\n[dry run] - ignored $1 steps:" 269 | fi 270 | print " $idx $name" 271 | return 0 272 | fi 273 | local sepline="# $idx $name ${(l:80::-:):-}" 274 | [[ -z ${didheader[$1]} ]] || print 275 | didheader[$1]=1 276 | print ${sepline[1,78]} 277 | # return false status to trigger the build section 278 | return 1 279 | } 280 | 281 | 282 | do_clean() { 283 | local PS4=">> " 284 | local msg_noupdate 285 | MSG_NOCLEAN="No cleanup needed for this package. Skipped." 286 | ListSkipOrDo clean "src/pycifrw (N/A)" || { 287 | print $MSG_NOCLEAN 288 | } || return $? 289 | ListSkipOrDo clean "src/diffpy.Structure" || ( 290 | setopt xtrace 291 | cd $SRCDIR/diffpy.Structure && 292 | rm -rf build temp diffpy.Structure.egg-info 293 | ) || return $? 294 | ListSkipOrDo clean "src/diffpy.utils" || ( 295 | setopt xtrace 296 | cd $SRCDIR/diffpy.utils && 297 | rm -rf build temp diffpy.utils.egg-info 298 | ) || return $? 299 | ListSkipOrDo clean "src/periodictable (N/A)" || { 300 | print $MSG_NOCLEAN 301 | } || return $? 302 | ListSkipOrDo clean "src/libobjcryst" || ( 303 | setopt xtrace 304 | cd $SRCDIR/libobjcryst && $SCONS --clean 305 | ) || return $? 306 | ListSkipOrDo clean "src/pyobjcryst" || ( 307 | setopt xtrace 308 | cd $SRCDIR/pyobjcryst && 309 | rm -rf build temp pyobjcryst.egg-info 310 | ) || return $? 311 | ListSkipOrDo clean "src/libdiffpy" || ( 312 | setopt xtrace 313 | cd $SRCDIR/libdiffpy && $SCONS --clean 314 | ) || return $? 315 | ListSkipOrDo clean "src/diffpy.srreal" || ( 316 | setopt xtrace 317 | cd $SRCDIR/diffpy.srreal && 318 | rm -rf build temp diffpy.srreal.egg-info 319 | ) || return $? 320 | ListSkipOrDo clean "src/diffpy.srfit" || ( 321 | setopt xtrace 322 | cd $SRCDIR/diffpy.srfit && 323 | rm -rf build temp diffpy.srreal.egg-info 324 | ) || return $? 325 | ListSkipOrDo clean "src/srfit-sasview (N/A)" || { 326 | print $MSG_NOCLEAN 327 | } || return $? 328 | } 329 | 330 | 331 | do_update() { 332 | local PS4=">> " 333 | local msg_noupdate 334 | MSG_NOUPDATE="Update of this package is not supported. Skipped." 335 | ListSkipOrDo update "src/pycifrw (N/A)" || { 336 | print $MSG_NOUPDATE 337 | } || return $? 338 | ListSkipOrDo update "src/diffpy.Structure" || ( 339 | setopt xtrace 340 | cd $SRCDIR/diffpy.Structure && git pull origin 341 | ) || return $? 342 | ListSkipOrDo update "src/diffpy.utils" || ( 343 | setopt xtrace 344 | cd $SRCDIR/diffpy.utils && git pull origin 345 | ) || return $? 346 | ListSkipOrDo update "src/periodictable (N/A)" || { 347 | print $MSG_NOUPDATE 348 | } || return $? 349 | ListSkipOrDo update "src/libobjcryst" || ( 350 | setopt xtrace 351 | cd $SRCDIR/libobjcryst && git pull origin 352 | ) || return $? 353 | ListSkipOrDo update "src/pyobjcryst" || ( 354 | setopt xtrace 355 | cd $SRCDIR/pyobjcryst && git pull origin 356 | ) || return $? 357 | ListSkipOrDo update "src/libdiffpy" || ( 358 | setopt xtrace 359 | cd $SRCDIR/libdiffpy && git pull origin 360 | ) || return $? 361 | ListSkipOrDo update "src/diffpy.srreal" || ( 362 | setopt xtrace 363 | cd $SRCDIR/diffpy.srreal && git pull origin 364 | ) || return $? 365 | ListSkipOrDo update "src/diffpy.srfit" || ( 366 | setopt xtrace 367 | cd $SRCDIR/diffpy.srfit && git pull origin 368 | ) || return $? 369 | ListSkipOrDo update "src/srfit-sasview (N/A)" || { 370 | print $MSG_NOUPDATE 371 | } || return $? 372 | } 373 | 374 | 375 | do_build() { 376 | adjust_build_environment 377 | 378 | if [[ -z ${opt_dryrun} && -n ${build_selection} ]]; then 379 | mkdir -p ${BINDIR?} ${INCLUDEDIR?} ${LIBDIR?} ${PYTHONDIR?} || exit $? 380 | # x86_64 fedora wants to install to lib64 - in such case create symbolic 381 | # link lib64 that points to lib 382 | local binlibdest=$($PYTHON -c \ 383 | "import distutils.sysconfig; \ 384 | print distutils.sysconfig.get_config_var('BINLIBDEST')") 385 | cd ${LIBDIR:h} 386 | if [[ ${binlibdest:h:h:t} == lib64 && ! lib64 -ef ${LIBDIR:t} ]]; then 387 | rm -f lib64 && ln -svf "${LIBDIR:t}" lib64 || exit $? 388 | fi 389 | fi 390 | 391 | ListSkipOrDo build "PyCifRW" || { 392 | python_easy_install -N --zip-ok --prefix=$BASEDIR \ 393 | ${SRCDIR}/pycifrw/PyCifRW-*.tar.gz(om[1]) 394 | } || return $? 395 | ListSkipOrDo build "diffpy.Structure" || { 396 | python_easy_install -ZN --prefix=$BASEDIR ${SRCDIR}/diffpy.Structure 397 | } || return $? 398 | ListSkipOrDo build "diffpy.utils" || { 399 | python_easy_install -ZN --prefix=$BASEDIR ${SRCDIR}/diffpy.utils 400 | } || return $? 401 | ListSkipOrDo build "periodictable" || { 402 | python_easy_install -ZN --prefix=$BASEDIR \ 403 | ${SRCDIR}/periodictable/periodictable-*.tar.gz(om[1]) 404 | } || return $? 405 | ListSkipOrDo build "libObjCryst" || { 406 | cd $SRCDIR/libobjcryst 407 | $SCONS -j $NCPU build=fast prefix=$BASEDIR install 408 | } || return $? 409 | ListSkipOrDo build "pyobjcryst" || { 410 | cd $SRCDIR/pyobjcryst 411 | $SCONS -j $NCPU prefix=$BASEDIR python=$PYTHON install 412 | } || return $? 413 | ListSkipOrDo build "libdiffpy" || { 414 | cd $SRCDIR/libdiffpy 415 | $SCONS -j $NCPU enable_objcryst=yes prefix=$BASEDIR install 416 | } || return $? 417 | ListSkipOrDo build "diffpy.srreal" || { 418 | cd $SRCDIR/diffpy.srreal 419 | $SCONS -j $NCPU prefix=$BASEDIR python=$PYTHON install 420 | } || return $? 421 | ListSkipOrDo build "diffpy.srfit" || { 422 | python_easy_install -ZN --prefix=$BASEDIR ${SRCDIR}/diffpy.srfit 423 | } || return $? 424 | ListSkipOrDo build "srfit-sasview" || { 425 | python_easy_install -ZN --prefix=$BASEDIR --exclude-scripts \ 426 | ${SRCDIR}/srfit-sasview/srfit-sasview-*.tar.gz(om[1]) 427 | } || return $? 428 | } 429 | 430 | 431 | install_pthfile() { 432 | local TGTDIR=$(print -lr \ 433 | 'import site, distutils.sysconfig' \ 434 | 'if site.ENABLE_USER_SITE: print site.USER_SITE' \ 435 | 'else: print distutils.sysconfig.get_python_lib()' \ 436 | | ${PYTHON} ) 437 | print 438 | print "Python path directory for installing ${PTHFILE:t}" 439 | vared -p '--> ' TGTDIR 440 | TGTDIR=${TGTDIR%%[[:space:]]##} 441 | expand_tilde TGTDIR 442 | if [[ -z $TGTDIR ]]; then 443 | print "No directory, installation cancelled." 444 | exit 1 445 | fi 446 | if [[ ! -d $TGTDIR ]]; then 447 | print "Directory $TGTDIR does not exist." 448 | read -q '?Create? (y/n) '; print 449 | if [[ $REPLY == [yY] ]]; then 450 | mkdir -p ${TGTDIR} || exit $? 451 | else 452 | print "No directory, installation cancelled." 453 | exit 1 454 | fi 455 | fi 456 | if [[ ${PTHFILE} -ef ${TGTDIR}/${PTHFILE:t} && -L ${TGTDIR}/${PTHFILE:t} ]]; 457 | then 458 | print "Symbolic link to ${PTHFILE:t} already exists, good!" 459 | else 460 | print "Creating symbolic link" 461 | # On Linux "ln -si" gives zero exit status even if user declines to 462 | # overwrite existing target. Add test if symbolic link indeed works. 463 | ln -siv ${PTHFILE} ${TGTDIR} && 464 | [[ ${PTHFILE} -ef ${TGTDIR}/${PTHFILE:t} ]] || exit $? 465 | fi 466 | print 467 | } 468 | 469 | 470 | install_scripts() { 471 | local scriptfiles 472 | scriptfiles=( ${BASEDIR}/bin/*(-*N) ) 473 | if [[ -z $scriptfiles ]]; then 474 | return 475 | fi 476 | TGTDIR=${HOME}/bin 477 | d=$(print -rD -- $TGTDIR) 478 | print "Directory for installing executable scripts" 479 | vared -p "--> " TGTDIR 480 | TGTDIR=${TGTDIR%%[[:space:]]##} 481 | expand_tilde TGTDIR 482 | if [[ ! -d ${TGTDIR} ]]; then 483 | print -D "Directory" $TGTDIR "does not exist, scripts not installed." 484 | print 485 | return 486 | fi 487 | # scrub scriptfiles that are already installed 488 | scriptfiles=( ${^scriptfiles}(Ne,'[[ ! $REPLY -ef $TGTDIR/${REPLY:t} ]]',) ) 489 | if [[ -z ${scriptfiles} ]]; then 490 | print "Scripts are already installed, good!" 491 | else 492 | print "Creating symbolic links:" 493 | ln -siv $scriptfiles ${TGTDIR} 494 | fi 495 | d=( ${^path}(Ne:'[[ $REPLY -ef $TGTDIR ]]':) ) 496 | if [[ -z $d ]]; then 497 | print -D "\nWARNING:" $TGTDIR "is not in the PATH." 498 | fi 499 | print 500 | } 501 | 502 | 503 | do_install() { 504 | print $HASHLINE 505 | print "Welcome to DiffPy-CMI ${VERSION?}" 506 | print $HASHLINE 507 | print 508 | print "Use of this software is subject to the terms in LICENSE.txt." 509 | do_license; 510 | local libfiles 511 | libfiles=( ${BASEDIR}/lib/*.(so|dylib)(N) ) 512 | if [[ ${#libfiles} -lt 2 ]]; then 513 | print 514 | print "Source only-distribution - we need to re-build all packages." 515 | REPLY=Y 516 | if [[ -z $opt_dryrun ]]; then 517 | read -q '?Proceed? (y/n) '; print 518 | fi 519 | print 520 | if [[ $REPLY != [yY] ]]; then 521 | print "Installation cancelled." 522 | exit 1 523 | fi 524 | expand_ranges build_selection all 525 | do_build || { 526 | print "\n$HASHLINE" 527 | print "Build failure, installation cancelled." 528 | print "$HASHLINE" 529 | print 530 | print "Check if all required software is installed and try again." 531 | exit 2 532 | } 533 | if [[ -z ${opt_dryrun} ]]; then 534 | print "\n$HASHLINE" 535 | print "All packages built successfully." 536 | print "$HASHLINE" 537 | fi 538 | fi 539 | if [[ -n ${opt_dryrun} ]]; then 540 | print "\n[dry run] - installation of symbolic links skipped." 541 | exit 542 | fi 543 | install_pthfile 544 | install_scripts 545 | print $FINALINFO 546 | } 547 | 548 | # Main section here ---------------------------------------------------------- 549 | 550 | if [[ -n ${opt_clean} ]]; then 551 | expand_ranges clean_selection ${${opt_clean##--clean=#}:-all} 552 | do_clean || exit $? 553 | fi 554 | 555 | if [[ -n ${opt_update} ]]; then 556 | expand_ranges update_selection ${${opt_update##--update=#}:-all} 557 | do_update || exit $? 558 | fi 559 | 560 | if [[ -n ${opt_build} ]]; then 561 | expand_ranges build_selection ${${opt_build##--build=#}:-all} 562 | do_build || exit $? 563 | fi 564 | 565 | if [[ -z "${opt_clean}${opt_update}${opt_build}" ]]; then 566 | do_install 567 | fi 568 | -------------------------------------------------------------------------------- /diffpy-cmi/makedist: -------------------------------------------------------------------------------- 1 | #!/bin/zsh -f 2 | 3 | setopt extendedglob 4 | setopt err_exit 5 | umask 022 6 | 7 | DOC="\ 8 | ${0:t} create binary or source bundle for the diffpy_cmi release. 9 | usage: ${0:t} [options] [all] [N] [N1-N2] 10 | 11 | With no arguments all build steps are performed in sequence. Otherwise 12 | perform only steps given as arguments, where each argument is either a 13 | single package number or an inclusive range of indices FIRST-LAST. 14 | Use option --list to display all steps. 15 | 16 | Options: 17 | 18 | -l, --list show a numbered list of packages and exit 19 | --source create a source-only package 20 | --clean remove all generated files except downloads 21 | --wipe do --clean and also remove all downloads and dist files 22 | -h, --help display this message and exit 23 | 24 | The following environment variables override script defaults: 25 | 26 | PYTHON python executable used for the build [python] 27 | SCONS SCons program used for the build [scons] 28 | TAR tar command used for packaging [tar or gnutar] 29 | NCPU number of CPUs used in parallel builds [all-cores]. 30 | PREFIX base directory for installing the binaries [.] 31 | " 32 | 33 | DOC=${${DOC##[[:space:]]##}%%[[:space:]]##} 34 | MYDIR=${0:A:h} 35 | BASEDIR=${MYDIR} 36 | PKGNAME=diffpy_cmi 37 | 38 | # Upstream code repositories ------------------------------------------------- 39 | 40 | ## edit URLs in this section to follow upstream updates. 41 | 42 | # git repositories for the sources in order of 43 | # (project, URL, branch[:TagOrHash]) 44 | gitrepos=( 45 | diffpy.Structure 46 | https://github.com/diffpy/diffpy.Structure.git 47 | master:v1.3.2 48 | diffpy.utils 49 | https://github.com/diffpy/diffpy.utils.git 50 | master:v1.2.1 51 | pyobjcryst 52 | https://github.com/diffpy/pyobjcryst.git 53 | master:v2.0.1 54 | libdiffpy 55 | https://github.com/diffpy/libdiffpy.git 56 | master:v1.3.1 57 | libobjcryst 58 | https://github.com/diffpy/libobjcryst.git 59 | master:v2015.1.2 60 | diffpy.srreal 61 | https://github.com/diffpy/diffpy.srreal.git 62 | master:v1.1 63 | diffpy.srfit 64 | https://github.com/diffpy/diffpy.srfit.git 65 | master:v1.1 66 | ) 67 | 68 | # Mercurial repositories for the sources in order of 69 | # (project, URL, branch[:TagOrHash]) 70 | hgrepos=( 71 | ) 72 | 73 | # URLs to source code bundles as (directory, URL) 74 | tarballs=( 75 | cxxtest 76 | https://github.com/CxxTest/cxxtest/releases/download/4.4/cxxtest-4.4.tar.gz 77 | pycifrw 78 | https://pypi.python.org/packages/source/P/PyCifRW/PyCifRW-4.1.1.tar.gz 79 | periodictable 80 | https://pypi.python.org/packages/source/p/periodictable/periodictable-1.4.1.tar.gz 81 | srfit-sasview 82 | https://github.com/diffpy/srfit-sasview/releases/download/sfsv3.1.2/srfit-sasview-3.1.2.tar.gz 83 | ) 84 | 85 | # Subversion repositories as (targetpath, URL) 86 | svnrepos=( 87 | ) 88 | 89 | # Parse command-line options ------------------------------------------------- 90 | 91 | zmodload zsh/zutil 92 | zparseopts -K -E -D \ 93 | h=opt_help -help=opt_help l=opt_list -list=opt_list \ 94 | -clean=opt_clean -wipe=opt_wipe -source=opt_source 95 | 96 | if [[ -n ${opt_help} ]]; then 97 | print -r -- $DOC 98 | exit 99 | fi 100 | 101 | if [[ -n ${opt_wipe} ]]; then 102 | opt_clean=1 103 | fi 104 | 105 | typeset -aU selection 106 | for n; do 107 | if [[ $n == [[:digit:]]##-[[:digit:]]## ]]; then 108 | selection=( $selection {${n%%-*}..${n##*-}} ) 109 | elif [[ $n == [[:digit:]]## ]]; then 110 | selection=( $selection $n ) 111 | elif [[ $n == all ]]; then 112 | selection=( {1..100} ) 113 | else 114 | print -u2 "Invalid option or argument '$n'." 115 | exit 2 116 | fi 117 | done 118 | 119 | if [[ -z ${opt_clean} && -z ${selection} ]]; then 120 | selection=( {1..100} ) 121 | fi 122 | 123 | # Resolve parameters that can be overloaded from the environment ------------- 124 | 125 | : ${PREFIX:=${BASEDIR}} 126 | : ${PYTHON:==python} 127 | : ${SCONS:==scons} 128 | : ${NCPU:=$(${PYTHON} -c \ 129 | 'from multiprocessing import cpu_count; print min(4, cpu_count())')} 130 | if [[ -z $TAR ]]; then 131 | TAR=tar 132 | if [[ $OSTYPE == darwin* ]]; then 133 | TAR=gnutar 134 | fi 135 | fi 136 | 137 | # Determine other parameters ------------------------------------------------- 138 | 139 | cd $BASEDIR 140 | 141 | SRCDIR=${BASEDIR}/src 142 | INCLUDEDIR=${PREFIX}/include 143 | LIBDIR=${PREFIX}/lib 144 | PYTHON_VERSION=$($PYTHON -c 'import sys; print "%s.%s" % sys.version_info[:2]') 145 | PYTHONDIR=$LIBDIR/python${PYTHON_VERSION}/site-packages 146 | VERSION=${"$(git describe --match='v[[:digit:]]*')"#v} 147 | VERSION_SHORT=${VERSION%-g[[:xdigit:]]##} 148 | 149 | if [[ -z $opt_source ]]; then 150 | SUFFIX=-py${PYTHON_VERSION}-${(L)$(uname -s)}-${CPUTYPE} 151 | fi 152 | 153 | PACKAGE=dist/${PKGNAME}-${VERSION_SHORT}${SUFFIX} 154 | 155 | # Adjust environment variables used in the build ----------------------------- 156 | 157 | export LIBRARY_PATH=$LIBDIR:$LIBRARY_PATH 158 | export LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH 159 | export CPATH=$INCLUDEDIR:$CPATH 160 | export PYTHONPATH=$PYTHONDIR:$PYTHONPATH 161 | 162 | # Define functions used in build steps --------------------------------------- 163 | 164 | integer BIDX=0 165 | 166 | ListSkipOrBuild() { 167 | local name=${1?} 168 | if [[ $2 == binary && -n $opt_source ]]; then 169 | return 0 170 | fi 171 | (( ++BIDX )) 172 | if [[ -z ${(M)selection:#${BIDX}} ]]; then 173 | return 0 174 | fi 175 | if [[ -n ${opt_list} ]]; then 176 | print $BIDX $name 177 | return 0 178 | fi 179 | local dashline="# $BIDX $name ${(l:80::-:):-}" 180 | print ${dashline[1,78]} 181 | # return false status to trigger the build section 182 | return 1 183 | } 184 | 185 | 186 | fetchgitrepository() { 187 | [[ $# == 3 ]] || exit $? 188 | local tgtdir=$1 url=$2 branch=${3%%:*} 189 | local tag=${${3#${branch}}##*:} 190 | if [[ ! -d $tgtdir ]]; then 191 | git clone -b $branch $url $tgtdir 192 | else ( 193 | cd $tgtdir && 194 | git checkout $branch && 195 | git pull --tags origin $branch 196 | ) 197 | fi 198 | if [[ -n $tag ]]; then ( 199 | cd $tgtdir 200 | if [[ -z "$(git log -1 $branch..$tag)" ]]; then 201 | git reset --hard $tag 202 | else 203 | git checkout --quiet $tag 204 | fi 205 | ) 206 | fi 207 | ( cd $tgtdir && git gc --prune=all ) 208 | } 209 | 210 | 211 | fetchhgrepository() { 212 | [[ $# == 3 ]] || exit $? 213 | local tgtdir=$1 url=$2 branch=${3%%:*} 214 | local tag=${${3#${branch}}##*:} 215 | if [[ ! -d $tgtdir ]]; then 216 | hg clone -b $branch $url $tgtdir 217 | else 218 | ( cd $tgtdir && hg pull -u -b $branch ) 219 | fi 220 | if [[ -n $tag ]]; then 221 | ( cd $tgtdir && hg update $tag ) 222 | fi 223 | } 224 | 225 | 226 | fetchsvnrepository() { 227 | [[ $# == 2 ]] || exit $? 228 | local tgtdir=$1 url=$2 229 | svn checkout $url $tgtdir 230 | } 231 | 232 | 233 | fetchtarball() { 234 | [[ $# == 2 ]] || exit $? 235 | local tgtdir=$1 url=$2 236 | local wget_opts 237 | wget_opts=( --timestamping --no-verbose ) 238 | if [[ -d /opt/local/share/curl ]]; then 239 | wget_opts+=( --ca-directory=/opt/local/share/curl ) 240 | fi 241 | mkdir -p $tgtdir 242 | ( cd $tgtdir && wget $wget_opts $url ) 243 | } 244 | 245 | 246 | python_easy_install() { 247 | local eicode='if True: 248 | import sys 249 | from setuptools.command.easy_install import main 250 | sys.argv[0] = "easy_install" 251 | main() 252 | ' 253 | ${PYTHON} -c "$eicode" "$@" 254 | } 255 | 256 | # Build commands here -------------------------------------------------------- 257 | 258 | if [[ -n $opt_clean ]]; then 259 | cd $BASEDIR 260 | if [[ -n $opt_wipe ]]; then 261 | print "# Cleaning all downloads and generated files." 262 | rm -rf ${BASEDIR}/src 263 | else 264 | print "# Cleaning all generated files except of source downloads." 265 | fi 266 | # Clean any generated files except the src directory 267 | rm -rf ${BASEDIR}/dist 268 | git clean -fdx --exclude=src 269 | 270 | # clean up all git repositories 271 | for gd in src/*/.git(N:h); ( 272 | cd $gd && git clean -fdx 273 | ) 274 | 275 | # clean up all subversion repositories 276 | for sd in src/*/.svn(/N:h) src/*/*/.svn(/N:h); ( 277 | cd $sd 278 | junkfiles=( ${(f)"$(svn status --no-ignore | grep '^[?I]' | cut -b9-)"} ) 279 | rm -vrf $junkfiles 280 | ) 281 | fi 282 | 283 | 284 | if [[ -z ${opt_list} && -n $selection ]]; then 285 | mkdir -p $INCLUDEDIR $LIBDIR $PYTHONDIR 286 | fi 287 | 288 | 289 | ListSkipOrBuild "download upstream sources" || ( 290 | mkdir -p $SRCDIR 291 | cd $SRCDIR 292 | for t u b in $gitrepos; fetchgitrepository $t $u $b 293 | for t u b in $hgrepos; fetchhgrepository $t $u $b 294 | for t u in $svnrepos; fetchsvnrepository $t $u 295 | for t u in $tarballs; fetchtarball $t $u 296 | ) 297 | 298 | ListSkipOrBuild "copy src-addons to the source tree" || { 299 | rsync -av ${BASEDIR}/src-addons/ ${SRCDIR}/ 300 | } 301 | 302 | ListSkipOrBuild "update version files" || { 303 | print -r "$VERSION" >| ${BASEDIR}/VERSION.txt 304 | cd $SRCDIR 305 | for f in $(grep -l version.cfg */setup.py(N) /dev/null); ( 306 | cd ${f:h} 307 | python setup.py egg_info 308 | ) 309 | } 310 | 311 | ListSkipOrBuild pycifrw binary || { 312 | python_easy_install -N --zip-ok --prefix=$PREFIX \ 313 | ${SRCDIR}/pycifrw/PyCifRW-*.tar.gz(om[1]) 314 | } 315 | 316 | ListSkipOrBuild diffpy.Structure binary || { 317 | python_easy_install -ZN --prefix=$PREFIX ${SRCDIR}/diffpy.Structure 318 | } 319 | 320 | ListSkipOrBuild diffpy.utils binary || { 321 | python_easy_install -ZN --prefix=$PREFIX ${SRCDIR}/diffpy.utils 322 | } 323 | 324 | ListSkipOrBuild periodictable binary || { 325 | python_easy_install -ZN --prefix=$PREFIX \ 326 | ${SRCDIR}/periodictable/periodictable-*.tar.gz(om[1]) 327 | } 328 | 329 | ListSkipOrBuild libObjCryst binary || { 330 | cd $SRCDIR/libobjcryst 331 | $SCONS -j $NCPU build=fast prefix=$PREFIX install 332 | } 333 | 334 | ListSkipOrBuild pyobjcryst binary || { 335 | cd $SRCDIR/pyobjcryst 336 | $SCONS -j $NCPU build=fast prefix=$PREFIX install 337 | } 338 | 339 | ListSkipOrBuild libdiffpy binary || { 340 | cd $SRCDIR/libdiffpy 341 | $SCONS -j $NCPU build=fast enable_objcryst=yes test 342 | $SCONS -j $NCPU build=fast enable_objcryst=yes prefix=$PREFIX install 343 | } 344 | 345 | ListSkipOrBuild diffpy.srreal binary || { 346 | cd $SRCDIR/diffpy.srreal 347 | $SCONS -j $NCPU build=fast prefix=$PREFIX install 348 | } 349 | 350 | ListSkipOrBuild srfit-sasview binary || { 351 | python_easy_install -ZN --prefix=$PREFIX --exclude-scripts \ 352 | ${SRCDIR}/srfit-sasview/srfit-sasview-*.tar.gz(om[1]) 353 | } 354 | 355 | ListSkipOrBuild diffpy.srfit binary || { 356 | python_easy_install -ZN --prefix=$PREFIX ${SRCDIR}/diffpy.srfit 357 | } 358 | 359 | # Skip when building on Mac OS X 360 | [[ $OSTYPE == darwin* ]] || 361 | ListSkipOrBuild "copy boost libraries" binary || { 362 | typeset -aU boostdeplibs 363 | for f in $LIBDIR/**/*.so(*N); do 364 | boostdeplibs+=( 365 | $(ldd $f | awk '$1 ~ /^libboost_/ && $2 == "=>" {print $3}') 366 | ) 367 | done 368 | if [[ -n ${boostdeplibs} ]]; then 369 | rsync -a ${boostdeplibs} $LIBDIR/ 370 | fi 371 | cd $LIBDIR 372 | for bp in ${boostdeplibs:t}; do 373 | tgt=${bp%.so*}.so 374 | [[ $bp -ef $tgt ]] || ln -sv ${bp} $tgt 375 | done 376 | } 377 | 378 | ListSkipOrBuild "create diffpy_cmi tarball" || { 379 | cd $BASEDIR 380 | mkdir -p ${PACKAGE} 381 | excludes=( 382 | # exclude intermediate build files 383 | build dist temp '.sconsign.*' .sconf_temp config.log '*.pyc' 384 | # remove subversion files in the packaged tree 385 | .svn 386 | # Use cxxtest at a fixed git-tag version 387 | src/cxxtest/.git 388 | # Use srfit-sasview at a fixed git-tag version 389 | src/srfit-sasview/.git 390 | ) 391 | sourcepaths=( 392 | install src *.pth *.sh *.txt 393 | ) 394 | if [[ -z ${opt_source} ]]; then 395 | sourcepaths+=( bin(N) share include lib ) 396 | fi 397 | rsync -av --delete --link-dest=$BASEDIR \ 398 | --exclude=$PACKAGE --exclude=${^excludes} \ 399 | ${sourcepaths?} $PACKAGE/ 400 | chmod -R go-w $PACKAGE 401 | # finally create the tar bundle 402 | $TAR czf ${PACKAGE}.tar.gz \ 403 | --directory ${PACKAGE:h} \ 404 | --numeric-owner --owner=0 --group=0 ${PACKAGE:t} 405 | } 406 | 407 | ListSkipOrBuild "clean the temporary package tree" || { 408 | rm -rf $PACKAGE 409 | } 410 | -------------------------------------------------------------------------------- /diffpy-cmi/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "# Testing diffpy.Structure:" 4 | python -m diffpy.Structure.tests.run 5 | echo 6 | 7 | echo "# Testing diffpy.utils:" 8 | python -m diffpy.utils.tests.run 9 | echo 10 | 11 | echo "# Testing diffpy.srreal:" 12 | python -m diffpy.srreal.tests.run 13 | echo 14 | 15 | echo "# Testing pyobjcryst:" 16 | python -m pyobjcryst.tests.run 17 | echo 18 | 19 | echo "# Testing diffpy.srfit:" 20 | python -m diffpy.srfit.tests.run 21 | -------------------------------------------------------------------------------- /diffpy-cmi/src-addons/diffpy.srreal/sconscript.local: -------------------------------------------------------------------------------- 1 | # Local tweaks to the scons build environment. 2 | 3 | Import('env') 4 | 5 | # Set RPATH to find the libdiffpy.so in the parent lib directory. 6 | rpath_quoted = "'$$ORIGIN/../../../../..'" 7 | if env['PLATFORM'] == 'darwin': 8 | rpath_quoted = rpath_quoted.replace('$$ORIGIN', '@loader_path') 9 | env.Prepend(LINKFLAGS="-Wl,-rpath," + rpath_quoted) 10 | 11 | # vim: ft=python 12 | -------------------------------------------------------------------------------- /diffpy-cmi/src-addons/libdiffpy/sconscript.local: -------------------------------------------------------------------------------- 1 | # Local tweaks to the scons build environment. 2 | 3 | import os.path 4 | Import('env') 5 | 6 | # Set RPATH to make the libdiffpy shared library search its 7 | # own directory for other required shared libraries. 8 | rpath_quoted = "'$$ORIGIN'" 9 | if env['PLATFORM'] == 'darwin': 10 | rpath_quoted = rpath_quoted.replace('$$ORIGIN', '@loader_path') 11 | env.Prepend(LINKFLAGS="-Wl,-rpath," + rpath_quoted) 12 | 13 | if env['PLATFORM'] == 'darwin': 14 | env.Replace(DARWIN_INSTALL_NAME='@rpath/$TARGET.file') 15 | 16 | # determine installation path of the cxxtest framework 17 | env['CXXTEST_INSTALL_DIR'] = os.path.abspath( 18 | os.path.join(Dir('.').abspath, '../cxxtest')) 19 | 20 | # vim: ft=python 21 | -------------------------------------------------------------------------------- /diffpy-cmi/src-addons/libobjcryst/sconscript.local: -------------------------------------------------------------------------------- 1 | # Local tweaks to the scons build environment. 2 | 3 | Import('env') 4 | 5 | if env['PLATFORM'] == 'darwin': 6 | env.Replace(DARWIN_INSTALL_NAME='@rpath/$TARGET.file') 7 | 8 | # vim: ft=python 9 | -------------------------------------------------------------------------------- /diffpy-cmi/src-addons/pyobjcryst/sconscript.local: -------------------------------------------------------------------------------- 1 | # Local tweaks to the scons build environment. 2 | 3 | Import('env') 4 | 5 | # Set RPATH to find the libObjCryst.so in the parent lib directory. 6 | rpath_quoted = "'$$ORIGIN/../../../..'" 7 | if env['PLATFORM'] == 'darwin': 8 | rpath_quoted = rpath_quoted.replace('$$ORIGIN', '@loader_path') 9 | env.Prepend(LINKFLAGS="-Wl,-rpath," + rpath_quoted) 10 | 11 | # vim: ft=python 12 | --------------------------------------------------------------------------------