"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "setup.py" between
pymol-v1.8.6.0.tar.bz2 and pymol-v2.1.0.tar.bz2

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-v1.8.6.0.tar.bz2):setup.py  (pymol-v2.1.0.tar.bz2)
skipping to change at line 19 skipping to change at line 19
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 import platform
import multiprocessing.pool
import monkeypatch_distutils
# handle extra arguments # handle extra arguments
class options: class options:
osx_frameworks = False osx_frameworks = False
jobs = int(os.getenv('JOBS', 0)) jobs = int(os.getenv('JOBS', 0))
no_libxml = False no_libxml = False
use_msgpackc = 'c++11' pyqt = 'PyQt5,PyQt4,PySide'
no_glut = False
use_msgpackc = 'guess'
help_distutils = False help_distutils = False
no_cxx11 = False no_cxx11 = False
# OS X <= 10.8 # OS X <= 10.8
if sys.platform == 'darwin' and tuple( if sys.platform == 'darwin' and tuple(
map(int, platform.mac_ver()[0].split('.'))) < (10, 9): map(int, platform.mac_ver()[0].split('.'))) < (10, 9):
options.no_cxx11 = True 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('--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', '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 " parser.add_argument('--no-cxx11', action="store_true", help="Disable "
"C++11 std library features. Will still require C++11 'auto' " "C++11 std library features. Will still require C++11 'auto' "
"keyword support.") "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")
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 options.jobs != 1: if True:
monkeypatch_distutils.pmap = multiprocessing.pool.ThreadPool(options.jobs or import monkeypatch_distutils
None).map monkeypatch_distutils.set_parallel_jobs(options.jobs)
def forms_uic(build_lib='modules'):
'''
Convert Qt UI files in "modules/pmg_qt/forms" to Python files in place
'''
def get_prefix_path():
'''
Return a list of paths which will be searched for "include",
"include/freetype2", "lib", "lib64" etc.
'''
try:
return os.environ['PREFIX_PATH'].split(os.pathsep)
except KeyError:
pass
if sys.platform.startswith("freebsd"):
return ["/usr/local"]
X11 = ['/usr/X11'] * (not options.osx_frameworks)
if sys.platform == 'darwin':
for prefix in ['/sw', '/opt/local', '/usr/local']:
if sys.executable.startswith(prefix):
return [prefix] + X11
if is_conda_env():
if sys.platform.startswith('win'):
return [os.path.join(sys.prefix, 'Library')]
return [sys.prefix] + X11
return ['/usr'] + X11
def is_conda_env():
return (
'conda' in sys.prefix or
'conda' in sys.version or
'Continuum' in sys.version or
sys.prefix == os.getenv('CONDA_PREFIX'))
def posix_find_lib(names, lib_dirs): def posix_find_lib(names, lib_dirs):
# http://stackoverflow.com/questions/1376184/determine-if-c-library-is-insta lled-on-unix # http://stackoverflow.com/questions/1376184/determine-if-c-library-is-insta lled-on-unix
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
args = ["cc", "-shared", "-o", os.devnull] + ["-L" + d for d in lib_dirs] args = ["cc", "-shared", "-o", os.devnull] + ["-L" + d for d in lib_dirs]
for name in names: for name in names:
p = Popen(args + ["-l" + name], stdout=PIPE, stderr=PIPE) p = Popen(args + ["-l" + name], stdout=PIPE, stderr=PIPE)
p.communicate() p.communicate()
if p.wait() == 0: if p.wait() == 0:
return name return name
raise IOError('could not find any of ' + str(names)) raise IOError('could not find any of ' + str(names))
def guess_msgpackc():
for prefix in prefix_path:
f = os.path.join(prefix, 'include', 'msgpack', 'version_master.h')
try:
m = re.search(r'MSGPACK_VERSION_MAJOR\s+(\d+)', open(f).read())
except EnvironmentError:
continue
if m is not None:
major = int(m.group(1))
if major > 1 and not options.no_cxx11:
return 'c++11'
if major > 0:
return 'c'
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)
class install_pymol(install): class install_pymol(install):
pymol_path = None pymol_path = None
bundled_pmw = False bundled_pmw = False
no_launcher = False no_launcher = False
user_options = install.user_options + [ user_options = install.user_options + [
('pymol-path=', None, 'PYMOL_PATH'), ('pymol-path=', None, 'PYMOL_PATH'),
('bundled-pmw', None, 'install bundled Pmw module'), ('bundled-pmw', None, 'install bundled Pmw module'),
('no-launcher', None, 'skip installation of the pymol launcher'), ('no-launcher', None, 'skip installation of the pymol launcher'),
skipping to change at line 109 skipping to change at line 170
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 import tarfile
pmwtgz = "modules/pmg_tk/pmw-py%d.tgz" % (sys.version_info[0]) pmwtgz = "modules/pmg_tk/pmw-py%d.tgz" % (sys.version_info[0])
if not os.path.exists(pmwtgz): if not os.path.exists(pmwtgz):
if sys.version_info[0] > 2:
raise UserWarning('bundled pmw.tgz not compatible with Pytho
n 3')
pmwtgz = "modules/pmg_tk/pmw.tgz" pmwtgz = "modules/pmg_tk/pmw.tgz"
tar = tarfile.open(pmwtgz) tar = tarfile.open(pmwtgz)
tar.extractall(self.install_libbase) tar.extractall(self.install_libbase)
tar.close() 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
skipping to change at line 150 skipping to change at line 213
self.mkpath(self.install_scripts) self.mkpath(self.install_scripts)
launch_script = os.path.join(self.install_scripts, launch_script) launch_script = os.path.join(self.install_scripts, launch_script)
python_exe = os.path.abspath(sys.executable) python_exe = os.path.abspath(sys.executable)
pymol_file = self.unchroot(os.path.join(self.install_libbase, 'pymol', ' __init__.py')) pymol_file = self.unchroot(os.path.join(self.install_libbase, 'pymol', ' __init__.py'))
pymol_path = self.unchroot(self.pymol_path) pymol_path = self.unchroot(self.pymol_path)
with open(launch_script, 'w') as out: with open(launch_script, 'w') as out:
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
out.write('set PYMOL_PATH=' + pymol_path + os.linesep) # paths relative to launcher, if possible
try:
python_exe = '%~dp0\\' + os.path.relpath(python_exe, self.in
stall_scripts)
except ValueError:
pass
try:
pymol_file = '%~dp0\\' + os.path.relpath(pymol_file, self.in
stall_scripts)
except ValueError:
pymol_file = os.path.abspath(pymol_file)
# 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(' %1 %2 %3 %4 %5 %6 %7 %8 %9' + os.linesep) out.write(' %*' + os.linesep)
else: else:
out.write('#!/bin/sh' + os.linesep) out.write('#!/bin/bash' + os.linesep)
if sys.platform.startswith('darwin'): if sys.platform.startswith('darwin'):
out.write('[ "$DISPLAY" == "" ] && export DISPLAY=":0.0"' + os.linesep) 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 = ["/usr", "/usr/X11"] prefix_path = get_prefix_path()
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",
skipping to change at line 201 skipping to change at line 274
libs = [] libs = []
pyogl_libs = [] pyogl_libs = []
lib_dirs = [] lib_dirs = []
ext_comp_args = [ ext_comp_args = [
# legacy stuff # legacy stuff
'-Wno-write-strings', '-Wno-write-strings',
'-Wno-unused-function', '-Wno-unused-function',
'-Wno-char-subscripts', '-Wno-char-subscripts',
] ]
ext_link_args = [] ext_link_args = []
ext_objects = []
data_files = [] data_files = []
ext_modules = [] ext_modules = []
if options.no_cxx11: if options.no_cxx11:
def_macros += [ def_macros += [
('_PYMOL_NO_CXX11', None), ('_PYMOL_NO_CXX11', None),
] ]
if options.use_msgpackc == 'c++11': if options.use_msgpackc == 'c++11':
options.use_msgpackc = 'no' options.use_msgpackc = 'no'
skipping to change at line 228 skipping to change at line 302
("_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)
] ]
libs += ["xml2"] libs += ["xml2"]
if options.use_msgpackc == 'guess':
options.use_msgpackc = guess_msgpackc()
if options.use_msgpackc == 'no': if options.use_msgpackc == 'no':
def_macros += [("_PYMOL_NO_MSGPACKC", None)] def_macros += [("_PYMOL_NO_MSGPACKC", None)]
else: else:
if options.use_msgpackc == 'c++11': if options.use_msgpackc == 'c++11':
def_macros += [("MMTF_MSGPACK_USE_CPP11", None)] def_macros += [("MMTF_MSGPACK_USE_CPP11", None)]
else: else:
libs += ['msgpackc'] libs += ['msgpackc']
pymol_src_dirs += ["contrib/mmtf-c"] pymol_src_dirs += ["contrib/mmtf-c"]
if options.no_glut:
def_macros += [
("_PYMOL_NO_MAIN", None),
]
inc_dirs = list(pymol_src_dirs) inc_dirs = list(pymol_src_dirs)
#============================================================================ #============================================================================
if sys.platform=='win32': if sys.platform=='win32':
# NOTE: this branch not tested in years and may not work... # NOTE: this branch not tested in years and may not work...
inc_dirs += [ inc_dirs += [
"win32/include"] "win32/include"]
libs=["opengl32","glu32","glut32","libpng","zlib"] libs=["opengl32","glu32","glut32","libpng","zlib"]
pyogl_libs = ["opengl32","glu32","glut32"] pyogl_libs = ["opengl32","glu32","glut32"]
lib_dirs=["win32/lib"] lib_dirs=["win32/lib"]
skipping to change at line 270 skipping to change at line 352
("CYGWIN",None), ("CYGWIN",None),
("_PYMOL_LIBPNG",None)] ("_PYMOL_LIBPNG",None)]
#============================================================================ #============================================================================
else: # unix style (linux, mac, ...) else: # unix style (linux, mac, ...)
def_macros += [ def_macros += [
("_PYMOL_FREETYPE",None), ("_PYMOL_FREETYPE",None),
("NO_MMLIBS",None), ("NO_MMLIBS",None),
] ]
if sys.platform == 'darwin':
for prefix in ['/sw', '/opt/local', '/usr/local']:
if sys.executable.startswith(prefix):
prefix_path.insert(0, prefix)
elif sys.platform.startswith("freebsd"):
prefix_path = ["/usr/local"]
if 'anaconda' in sys.executable.lower():
prefix_path.insert(0, sys.executable.split('/bin/')[0])
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"] libs += ["png", "freetype"]
try:
prefix_path = os.environ['PREFIX_PATH'].split(os.pathsep)
except KeyError:
pass
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 sys.platform == 'darwin' and options.osx_frameworks:
ext_link_args += [ ext_link_args += [
"-framework", "OpenGL", "-framework", "OpenGL",
"-framework", "GLUT", "-framework", "GLUT",
] ]
def_macros += [
("_PYMOL_OSX", None),
]
else: else:
glut = posix_find_lib(['glut', 'freeglut'], lib_dirs) pyogl_libs += ["GL"]
pyogl_libs += ["GL", "GLU", glut] if not options.no_glut:
glut = posix_find_lib(['glut', 'freeglut'], lib_dirs)
pyogl_libs += [glut]
libs += ["GLEW"] libs += ["GLEW"]
libs += pyogl_libs libs += pyogl_libs
ext_comp_args += ["-ffast-math", "-funroll-loops", "-fcommon"] ext_comp_args += ["-ffast-math", "-funroll-loops", "-fcommon"]
# 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 += ["-O3"] ext_comp_args += ["-O3"]
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]
def get_sources(subdirs, suffixes=('.c', '.cpp')): def get_sources(subdirs, suffixes=('.c', '.cpp')):
return [f for d in subdirs for s in suffixes for f in glob(d + '/*' + s)] return sorted([f for d in subdirs for s in suffixes for f in glob(d + '/*' + s)])
def get_packages(base, parent='', r=None): def get_packages(base, parent='', r=None):
from os.path import join, exists from os.path import join, exists
if r is None: if r is None:
r = [] r = []
if parent: if parent:
r.append(parent) r.append(parent)
for name in os.listdir(join(base, parent)): for name in os.listdir(join(base, parent)):
if '.' not in name and exists(join(base, parent, name, '__init__.py')): if '.' not in name and exists(join(base, parent, name, '__init__.py')):
get_packages(base, join(parent, name), r) get_packages(base, join(parent, name), r)
skipping to change at line 354 skipping to change at line 426
ext_modules += [ ext_modules += [
Extension("pymol._cmd", Extension("pymol._cmd",
get_sources(pymol_src_dirs), get_sources(pymol_src_dirs),
include_dirs = inc_dirs, include_dirs = inc_dirs,
libraries = libs, libraries = libs,
library_dirs = lib_dirs, library_dirs = lib_dirs,
define_macros = def_macros, define_macros = def_macros,
extra_link_args = ext_link_args, extra_link_args = ext_link_args,
extra_compile_args = ext_comp_args, extra_compile_args = ext_comp_args,
extra_objects = ext_objects,
), ),
Extension("chempy.champ._champ", Extension("chempy.champ._champ",
get_sources(['contrib/champ']), get_sources(['contrib/champ']),
include_dirs=["contrib/champ"], include_dirs=["contrib/champ"],
), ),
] ]
distribution = setup ( # Distribution meta-data distribution = setup ( # Distribution meta-data
cmdclass = { cmdclass = {
skipping to change at line 379 skipping to change at line 452
author = "Schrodinger", author = "Schrodinger",
url = "http://pymol.org", url = "http://pymol.org",
contact = "pymol-users@lists.sourceforge.net", contact = "pymol-users@lists.sourceforge.net",
description = ("PyMOL is a Python-enhanced molecular graphics tool. " description = ("PyMOL is a Python-enhanced molecular graphics tool. "
"It excels at 3D visualization of proteins, small molecules, density, " "It excels at 3D visualization of proteins, small molecules, density, "
"surfaces, and trajectories. It also includes molecular editing, " "surfaces, and trajectories. It also includes molecular editing, "
"ray tracing, and movies. Open Source PyMOL is free to everyone!"), "ray tracing, and movies. Open Source PyMOL is free to everyone!"),
package_dir = package_dir, package_dir = package_dir,
packages = list(package_dir), packages = list(package_dir),
package_data = {'pmg_qt': ['forms/*.ui']},
ext_modules = ext_modules, ext_modules = ext_modules,
data_files = data_files, data_files = data_files,
) )
 End of changes. 22 change blocks. 
30 lines changed or deleted 106 lines changed or added

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