"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "setup.py" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

setup.py  (pymol-open-source-2.2.0):setup.py  (pymol-open-source-2.3.0)
skipping to change at line 17 skipping to change at line 17
# pre-installed into the system. # pre-installed into the system.
from distutils.core import setup, Extension from distutils.core import setup, Extension
from distutils.util import change_root from distutils.util import change_root
from distutils.errors import * from distutils.errors import *
from distutils.command.install import install from distutils.command.install import install
from distutils.command.build_py import build_py from distutils.command.build_py import build_py
from glob import glob from glob import glob
import shutil import shutil
import sys, os, re import sys, os, re
import platform
# non-empty DEBUG variable turns off optimization and adds -g flag
DEBUG = bool(os.getenv('DEBUG', ''))
WIN = sys.platform.startswith('win')
MAC = sys.platform.startswith('darwin')
# handle extra arguments # handle extra arguments
class options: class options:
osx_frameworks = False osx_frameworks = True
jobs = int(os.getenv('JOBS', 0)) jobs = int(os.getenv('JOBS', 0))
no_libxml = False no_libxml = False
pyqt = 'PyQt5,PyQt4,PySide' no_glut = True
no_glut = False
use_msgpackc = 'guess' use_msgpackc = 'guess'
help_distutils = False help_distutils = False
no_cxx11 = False testing = False
# OS X <= 10.8
if sys.platform == 'darwin' and tuple(
map(int, platform.mac_ver()[0].split('.'))) < (10, 9):
options.no_cxx11 = True
try: try:
import argparse import argparse
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--pyqt')
parser.add_argument('--no-glut', action="store_true") parser.add_argument('--no-glut', action="store_true")
parser.add_argument('--glut', dest='no_glut', action="store_false",
help="link with GLUT (legacy GUI)")
parser.add_argument('--no-osx-frameworks', dest='osx_frameworks',
action="store_false")
parser.add_argument('--osx-frameworks', action="store_true", parser.add_argument('--osx-frameworks', action="store_true",
help="on MacOS use OpenGL and GLUT frameworks instead of shared " help="on MacOS use OpenGL and GLUT frameworks instead of shared "
"libraries from XQuartz. Note that the GLUT framework has no " "libraries from XQuartz. Note that the GLUT framework has no "
"mouse wheel support, so this option is generally not desired.") "mouse wheel support, so this option is generally not desired.")
parser.add_argument('--jobs', '-j', type=int, help="for parallel builds " parser.add_argument('--jobs', '-j', type=int, help="for parallel builds "
"(defaults to number of processors)") "(defaults to number of processors)")
parser.add_argument('--no-libxml', action="store_true", parser.add_argument('--no-libxml', action="store_true",
help="skip libxml2 dependency, disables COLLADA export") help="skip libxml2 dependency, disables COLLADA export")
parser.add_argument('--use-msgpackc', choices=('c++11', 'c', 'guess', 'no'), parser.add_argument('--use-msgpackc', choices=('c++11', 'c', 'guess', 'no'),
help="c++11: use msgpack-c header-only library; c: link against " help="c++11: use msgpack-c header-only library; c: link against "
"shared library; no: disable fast MMTF load support") "shared library; no: disable fast MMTF load support")
parser.add_argument('--no-cxx11', action="store_true", help="Disable "
"C++11 std library features. Will still require C++11 'auto' "
"keyword support.")
parser.add_argument('--help-distutils', action="store_true", parser.add_argument('--help-distutils', action="store_true",
help="show help for distutils options and exit") help="show help for distutils options and exit")
parser.add_argument('--testing', action="store_true",
help="Build C-level tests")
options, sys.argv[1:] = parser.parse_known_args(namespace=options) options, sys.argv[1:] = parser.parse_known_args(namespace=options)
except ImportError: except ImportError:
print("argparse not available") print("argparse not available")
if options.help_distutils: if options.help_distutils:
sys.argv.append("--help") sys.argv.append("--help")
if True: if True:
import monkeypatch_distutils import monkeypatch_distutils
monkeypatch_distutils.set_parallel_jobs(options.jobs) monkeypatch_distutils.set_parallel_jobs(options.jobs)
skipping to change at line 107 skipping to change at line 108
return ['/usr'] + X11 return ['/usr'] + X11
def is_conda_env(): def is_conda_env():
return ( return (
'conda' in sys.prefix or 'conda' in sys.prefix or
'conda' in sys.version or 'conda' in sys.version or
'Continuum' in sys.version or 'Continuum' in sys.version or
sys.prefix == os.getenv('CONDA_PREFIX')) sys.prefix == os.getenv('CONDA_PREFIX'))
def posix_find_lib(names, lib_dirs):
# http://stackoverflow.com/questions/1376184/determine-if-c-library-is-insta
lled-on-unix
from subprocess import Popen, PIPE
args = ["cc", "-shared", "-o", os.devnull] + ["-L" + d for d in lib_dirs]
for name in names:
p = Popen(args + ["-l" + name], stdout=PIPE, stderr=PIPE)
p.communicate()
if p.wait() == 0:
return name
raise IOError('could not find any of ' + str(names))
def guess_msgpackc(): def guess_msgpackc():
for prefix in prefix_path: for prefix in prefix_path:
f = os.path.join(prefix, 'include', 'msgpack', 'version_master.h') f = os.path.join(prefix, 'include', 'msgpack', 'version_master.h')
try: try:
m = re.search(r'MSGPACK_VERSION_MAJOR\s+(\d+)', open(f).read()) m = re.search(r'MSGPACK_VERSION_MAJOR\s+(\d+)', open(f).read())
except EnvironmentError: except EnvironmentError:
continue continue
if m is not None: if m is not None:
major = int(m.group(1)) major = int(m.group(1))
if major > 1 and not options.no_cxx11: if major > 1:
return 'c++11' return 'c++11'
if major > 0:
return 'c'
return 'no' return 'no'
class build_py_pymol(build_py): class build_py_pymol(build_py):
def run(self): def run(self):
build_py.run(self) build_py.run(self)
forms_uic(self.build_lib) forms_uic(self.build_lib)
class install_pymol(install): class install_pymol(install):
pymol_path = None pymol_path = None
skipping to change at line 167 skipping to change at line 155
self.pymol_path = change_root(self.root, self.pymol_path) self.pymol_path = change_root(self.root, self.pymol_path)
def run(self): def run(self):
install.run(self) install.run(self)
self.install_pymol_path() self.install_pymol_path()
if not self.no_launcher: if not self.no_launcher:
self.make_launch_script() self.make_launch_script()
if self.bundled_pmw: if self.bundled_pmw:
import tarfile raise Exception('--bundled-pmw has been removed, please install Pmw
pmwtgz = "modules/pmg_tk/pmw-py%d.tgz" % (sys.version_info[0]) from '
if not os.path.exists(pmwtgz): 'https://github.com/schrodinger/pmw-patched')
if sys.version_info[0] > 2:
raise UserWarning('bundled pmw.tgz not compatible with Pytho
n 3')
pmwtgz = "modules/pmg_tk/pmw.tgz"
tar = tarfile.open(pmwtgz)
tar.extractall(self.install_libbase)
tar.close()
def unchroot(self, name): def unchroot(self, name):
if self.root is not None and name.startswith(self.root): if self.root is not None and name.startswith(self.root):
return name[len(self.root):] return name[len(self.root):]
return name return name
def copy_tree_nosvn(self, src, dst): def copy_tree_nosvn(self, src, dst):
ignore = lambda src, names: set(['.svn']).intersection(names) ignore = lambda src, names: set(['.svn']).intersection(names)
if os.path.exists(dst): if os.path.exists(dst):
shutil.rmtree(dst) shutil.rmtree(dst)
skipping to change at line 228 skipping to change at line 209
try: try:
pymol_file = '%~dp0\\' + os.path.relpath(pymol_file, self.in stall_scripts) pymol_file = '%~dp0\\' + os.path.relpath(pymol_file, self.in stall_scripts)
except ValueError: except ValueError:
pymol_file = os.path.abspath(pymol_file) pymol_file = os.path.abspath(pymol_file)
# out.write('set PYMOL_PATH=' + pymol_path + os.linesep) # out.write('set PYMOL_PATH=' + pymol_path + os.linesep)
out.write('"%s" "%s"' % (python_exe, pymol_file)) out.write('"%s" "%s"' % (python_exe, pymol_file))
out.write(' %*' + os.linesep) out.write(' %*' + os.linesep)
else: else:
out.write('#!/bin/sh' + os.linesep) out.write('#!/bin/sh' + os.linesep)
if sys.platform.startswith('darwin'):
out.write('[ "$DISPLAY" == "" ] && export DISPLAY=":0.0"' +
os.linesep)
out.write('export PYMOL_PATH="%s"' % pymol_path + os.linesep) out.write('export PYMOL_PATH="%s"' % pymol_path + os.linesep)
out.write('"%s" "%s" "$@"' % (python_exe, pymol_file) + os.lines ep) out.write('"%s" "%s" "$@"' % (python_exe, pymol_file) + os.lines ep)
os.chmod(launch_script, 0o755) os.chmod(launch_script, 0o755)
#============================================================================ #============================================================================
# should be something like (build_base + "/generated"), but that's only # should be something like (build_base + "/generated"), but that's only
# known to build and install instances # known to build and install instances
generated_dir = os.path.join(os.environ.get("PYMOL_BLD", "build"), "generated") generated_dir = os.path.join(os.environ.get("PYMOL_BLD", "build"), "generated")
import create_shadertext import create_shadertext
create_shadertext.create_all(generated_dir) create_shadertext.create_all(generated_dir)
# can be changed with environment variable PREFIX_PATH # can be changed with environment variable PREFIX_PATH
prefix_path = get_prefix_path() prefix_path = get_prefix_path()
inc_dirs = [
]
pymol_src_dirs = [ pymol_src_dirs = [
"ov/src", "ov/src",
"layer0", "layer0",
"layer1", "layer1",
"layer2", "layer2",
"layer3", "layer3",
"layer4", "layer4",
"layer5", "layer5",
"modules/cealign/src", "modules/cealign/src",
generated_dir, generated_dir,
] ]
def_macros = [ def_macros = [
("_PYMOL_LIBPNG", None), ("_PYMOL_LIBPNG", None),
("_PYMOL_FREETYPE", None),
("_PYMOL_INLINE", None), ("_PYMOL_INLINE", None),
] ]
libs = [] libs = ["png", "freetype"]
pyogl_libs = []
lib_dirs = [] lib_dirs = []
ext_comp_args = [ ext_comp_args = [
"-Wno-narrowing", "-Wno-narrowing",
# legacy stuff # legacy stuff
'-Wno-unused-function',
'-Wno-char-subscripts', '-Wno-char-subscripts',
# optimizations # optimizations
"-ffast-math", "-ffast-math",
"-funroll-loops", "-funroll-loops",
"-O3", "-O0" if DEBUG else "-O3",
"-fcommon", "-fcommon",
] ]
ext_link_args = [] ext_link_args = []
ext_objects = [] ext_objects = []
data_files = [] data_files = []
ext_modules = [] ext_modules = []
if options.no_cxx11:
def_macros += [
('_PYMOL_NO_CXX11', None),
]
if options.use_msgpackc == 'c++11':
options.use_msgpackc = 'no'
if True: if True:
# VMD plugin support # VMD plugin support
pymol_src_dirs += [ inc_dirs += [
'contrib/uiuc/plugins/include', 'contrib/uiuc/plugins/include',
]
pymol_src_dirs += [
'contrib/uiuc/plugins/molfile_plugin/src', 'contrib/uiuc/plugins/molfile_plugin/src',
] ]
def_macros += [ def_macros += [
("_PYMOL_VMD_PLUGINS", None), ("_PYMOL_VMD_PLUGINS", None),
] ]
if not options.no_libxml: if not options.no_libxml:
# COLLADA support # COLLADA support
def_macros += [ def_macros += [
("_HAVE_LIBXML", None) ("_HAVE_LIBXML", None)
skipping to change at line 325 skipping to change at line 301
else: else:
libs += ['msgpackc'] libs += ['msgpackc']
pymol_src_dirs += ["contrib/mmtf-c"] pymol_src_dirs += ["contrib/mmtf-c"]
if options.no_glut: if options.no_glut:
def_macros += [ def_macros += [
("_PYMOL_NO_MAIN", None), ("_PYMOL_NO_MAIN", None),
] ]
inc_dirs = list(pymol_src_dirs) if options.testing:
pymol_src_dirs += ["layerCTest"]
def_macros += [("_PYMOL_CTEST", None)]
inc_dirs += pymol_src_dirs
#============================================================================ #============================================================================
if sys.platform=='win32': if MAC:
# NOTE: this branch not tested in years and may not work... libs += ["GLEW"]
inc_dirs += [
"win32/include"]
libs=["opengl32","glu32","glut32","libpng","zlib"]
pyogl_libs = ["opengl32","glu32","glut32"]
lib_dirs=["win32/lib"]
def_macros += [
("WIN32",None),
("_PYMOL_LIBPNG",None),
]
ext_link_args=['/NODEFAULTLIB:"LIBC"']
#============================================================================
elif sys.platform=='cygwin':
# NOTE: this branch not tested in years and may not work...
libs=["glut32","opengl32","glu32","png"]
pyogl_libs = ["glut32","opengl32","glu32"]
lib_dirs=["/usr/lib/w32api"]
def_macros += [
("CYGWIN",None),
("_PYMOL_LIBPNG",None)]
#============================================================================
else: # unix style (linux, mac, ...)
def_macros += [ if options.osx_frameworks:
("_PYMOL_FREETYPE",None), ext_link_args += [
("NO_MMLIBS",None), "-framework", "OpenGL",
] + (not options.no_glut) * [
"-framework", "GLUT",
]
def_macros += [
("_PYMOL_OSX", None),
]
else:
libs += [
"GL",
] + (not options.no_glut) * [
"glut",
] ]
if WIN:
# clear
libs = []
ext_comp_args = []
def_macros += [
("WIN32", None),
("CINTERFACE", None), # avoid "Alloc" macro conflict
]
libs += [
"Ws2_32", # htonl
]
if True:
libs += [
"glew32",
"freetype",
"libpng",
] + (not options.no_glut) * [
"freeglut",
] + (not options.no_libxml) * [
"libxml2",
]
if DEBUG:
ext_comp_args += ['/Z7']
ext_link_args += ['/DEBUG']
libs += [
"opengl32",
]
if not (MAC or WIN):
libs += [
"GL",
"GLEW",
] + (not options.no_glut) * [
"glut",
]
if True:
try: try:
import numpy import numpy
inc_dirs += [ inc_dirs += [
numpy.get_include(), numpy.get_include(),
] ]
def_macros += [ def_macros += [
("_PYMOL_NUMPY", None), ("_PYMOL_NUMPY", None),
] ]
except ImportError: except ImportError:
print("numpy not available") print("numpy not available")
libs += ["png", "freetype"] if True:
for prefix in prefix_path: for prefix in prefix_path:
for dirs, suffixes in [ for dirs, suffixes in [
[inc_dirs, [("include",), ("include", "freetype2"), ("include", "libxml2")]], [inc_dirs, [("include",), ("include", "freetype2"), ("include", "libxml2")]],
[lib_dirs, [("lib64",), ("lib",)]], [lib_dirs, [("lib64",), ("lib",)]],
]: ]:
dirs.extend(filter(os.path.isdir, [os.path.join(prefix, *s) for s in suffixes])) dirs.extend(filter(os.path.isdir, [os.path.join(prefix, *s) for s in suffixes]))
if sys.platform == 'darwin' and options.osx_frameworks: if True:
ext_link_args += [
"-framework", "OpenGL",
"-framework", "GLUT",
]
def_macros += [
("_PYMOL_OSX", None),
]
else:
pyogl_libs += ["GL"]
if not options.no_glut:
glut = posix_find_lib(['glut', 'freeglut'], lib_dirs)
pyogl_libs += [glut]
libs += ["GLEW"]
libs += pyogl_libs
if sys.platform.startswith("freebsd"): if sys.platform.startswith("freebsd"):
libs += ["execinfo"] libs += ["execinfo"]
# optimization currently causes a clang segfault on OS X 10.9 when # optimization currently causes a clang segfault on OS X 10.9 when
# compiling layer2/RepCylBond.cpp # compiling layer2/RepCylBond.cpp
if sys.platform == 'darwin': if sys.platform == 'darwin':
ext_comp_args += ["-fno-strict-aliasing"] ext_comp_args += ["-fno-strict-aliasing"]
def get_pymol_version(): def get_pymol_version():
return re.findall(r'_PyMOL_VERSION "(.*)"', open('layer0/Version.h').read()) [0] return re.findall(r'_PyMOL_VERSION "(.*)"', open('layer0/Version.h').read()) [0]
 End of changes. 27 change blocks. 
100 lines changed or deleted 94 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)