[pytango] 10/483: fixes #3284435; fixes #3284440 (I hope)
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:19 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.
commit de9c2c964058450490c77e26b53a2cb205885582
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Tue Apr 12 07:59:46 2011 +0000
fixes #3284435; fixes #3284440 (I hope)
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@16503 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
doc/revision.rst | 1 +
setup.py | 170 ++++++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 132 insertions(+), 39 deletions(-)
diff --git a/doc/revision.rst b/doc/revision.rst
index 794c945..4fd4599 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -72,6 +72,7 @@ Version history
| | - 3284174: 7.1.4 does not build with gcc 4.5 and tango 7.2.6 |
| | - 3284265: [pytango][7.1.4] a few files without licence and copyright |
| | - 3284318: copyleft vs copyright |
+| | - 3284434: [pytango][doc] few ERROR during the doc generation |
+------------+-------------------------------------------------------------------------------------+
| 7.1.4 | Features: |
| | - from sourceforge: |
diff --git a/setup.py b/setup.py
index 353a4a2..bc74f37 100644
--- a/setup.py
+++ b/setup.py
@@ -25,18 +25,15 @@ import os
import sys
import errno
import platform
-
-#from ez_setup import use_setuptools
-#use_setuptools()
-
-#from setuptools import setup
-#from setuptools import Extension, Distribution
+import copy
+import shutil
+import imp
+import StringIO
from distutils.core import setup, Extension
from distutils.dist import Distribution
import distutils.sysconfig
-
try:
import sphinx
except:
@@ -50,9 +47,20 @@ try:
except:
IPython = None
-sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'PyTango'))
+def abspath(*path):
+ """A method to determine absolute path for a given relative path to the
+ directory where this setup.py script is located"""
+ setup_dir = os.path.dirname(os.path.abspath(__file__))
+ return os.path.join(setup_dir, *path)
+
+def get_release_info():
+ name = "release"
+ release_dir = abspath('PyTango')
+ data = imp.find_module(name, [release_dir])
+ release = imp.load_module(name, *data)
+ return release.Release
-from release import Release
+Release = get_release_info()
BOOST_ROOT = OMNI_ROOT = TANGO_ROOT = NUMPY_ROOT = '/usr'
@@ -297,19 +305,43 @@ _pytango = Extension(name = '_PyTango',
from distutils.cmd import Command
from distutils.command.build import build as dftbuild
from distutils.command.build_ext import build_ext as dftbuild_ext
+from distutils.command.install import install as dftinstall
from distutils.unixccompiler import UnixCCompiler
class build(dftbuild):
+ user_options = dftbuild.user_options + \
+ [('ipython-local', None, "install spock as current user profile instead of as an ipython extension"),
+ ('ipython-dir=', None, "Location of the ipython installation. (Defaults to '%s' if ipython-local is NOT set or to '%s' otherwise" % (_IPY_ROOT, _IPY_LOCAL) ) ]
+
+ boolean_options = [ 'ipython-local' ]
+
+ def initialize_options (self):
+ dftbuild.initialize_options(self)
+ self.ipython_dir = None
+ self.ipython_local = False
+
+ def finalize_options(self):
+ dftbuild.finalize_options(self)
+ if self.ipython_dir is None:
+ if self.ipython_local:
+ global _IPY_LOCAL
+ self.ipython_dir = _IPY_LOCAL
+ else:
+ global _IPY_ROOT
+ self.ipython_dir = os.path.join(_IPY_ROOT, "Extensions")
+ else:
+ if ipython-local:
+ self.warn("Both options 'ipython-dir' and 'ipython-local' were given. " \
+ "'ipython-dir' will be used.")
+ self.ensure_dirname('ipython_dir')
+
def has_doc(self):
if sphinx is None: return False
setup_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.isdir(os.path.join(setup_dir, 'doc'))
- def has_ipython(self):
- return IPython is not None
-
- sub_commands = dftbuild.sub_commands + [('build_doc', has_doc), ('build_spock', has_ipython)]
+ sub_commands = dftbuild.sub_commands + [('build_doc', has_doc),]
cmdclass = {'build' : build }
@@ -342,9 +374,9 @@ if sphinx:
cmdclass['build_doc'] = build_doc
if IPython:
- class build_spock(Command):
+ class install_spock(Command):
- description = "Build Spock, the PyTango's IPython extension"
+ description = "Install Spock, the PyTango's IPython extension"
user_options = [
('ipython-local', None, "install spock as current user profile instead of as an ipython extension"),
@@ -357,28 +389,13 @@ if IPython:
self.ipython_local = False
def finalize_options(self):
- if self.ipython_dir is None:
- if self.ipython_local:
- global _IPY_LOCAL
- self.ipython_dir = _IPY_LOCAL
- else:
- global _IPY_ROOT
- self.ipython_dir = os.path.join(_IPY_ROOT, "Extensions")
- else:
- if ipython-local:
- self.warn("Both options 'ipython-dir' and 'ipython-local' were given. " \
- "'ipython-dir' will be used.")
- self.ensure_dirname('ipython_dir')
+ self.set_undefined_options('install',
+ ('ipython_local', 'ipython_local'),
+ ('ipython_dir', 'ipython_dir'))
def run(self):
added_path = False
try:
- # make sure the python path is pointing to the newly built
- # code so that the documentation is built on this and not a
- # previously installed version
- build = self.get_finalized_command('build')
- sys.path.insert(0, os.path.abspath(build.build_lib))
- added_path=True
import PyTango.ipython
PyTango.ipython.install(self.ipython_dir, verbose=False)
except IOError, ioerr:
@@ -388,16 +405,91 @@ if IPython:
self.warn("Probably you don't have enough previledges to install spock as an ipython extension.")
self.warn("Try executing setup.py with sudo or otherwise give '--ipython-local' parameter to")
self.warn("setup.py to install spock as a current user ipython profile.")
- self.warn("type: setup.py --help build_spock for more information")
+ self.warn("type: setup.py --help install_spock for more information")
except Exception, e:
self.warn("Unable to install Spock IPython extension. Reason:")
self.warn(str(e))
-
- if added_path:
- sys.path.pop(0)
-
- cmdclass['build_spock'] = build_spock
+ cmdclass['install_spock'] = install_spock
+
+
+class install_html(Command):
+
+ user_options = [
+ ('install-dir=', 'd', 'base directory for installing HTML documentation files')]
+
+ def initialize_options(self):
+ self.install_dir = None
+
+ def finalize_options(self):
+ self.set_undefined_options('install',
+ ('install_html', 'install_dir'))
+
+ def run(self):
+ build_doc = self.get_finalized_command('build_doc')
+ src_html_dir = abspath(build_doc.build_dir, 'html')
+ self.copy_tree(src_html_dir, self.install_dir)
+
+cmdclass['install_html'] = install_html
+
+class install(dftinstall):
+
+ user_options = list(dftinstall.user_options)
+ user_options.extend([
+ ('ipython-local', None, "install spock as current user profile instead of as an ipython extension"),
+ ('ipython-dir=', None, "Location of the ipython installation. (Defaults to '%s' if ipython-local is NOT set or to '%s' otherwise" % (_IPY_ROOT, _IPY_LOCAL) ),
+ ('install-html=', None, "installation directory for HTML documentation") ])
+
+ boolean_options = list(dftinstall.boolean_options)
+ boolean_options.append('ipython-local')
+
+ def initialize_options(self):
+ dftinstall.initialize_options(self)
+ self.ipython_dir = None
+ self.ipython_local = False
+ self.install_html = None
+
+ def finalize_options(self):
+ dftinstall.finalize_options(self)
+ if self.ipython_dir is None:
+ if self.ipython_local:
+ global _IPY_LOCAL
+ self.ipython_dir = _IPY_LOCAL
+ else:
+ global _IPY_ROOT
+ self.ipython_dir = os.path.join(_IPY_ROOT, "Extensions")
+ else:
+ if ipython-local:
+ self.warn("Both options 'ipython-dir' and 'ipython-local' were given. " \
+ "'ipython-dir' will be used.")
+ self.ensure_dirname('ipython_dir')
+
+ # We do a hack here. We cannot trust the 'install_base' value because it
+ # is not always the final target. For example, in unix, the install_base
+ # is '/usr' and all other install_* are directly relative to it. However,
+ # in unix-local (like ubuntu) install_base is still '/usr' but, for
+ # example, install_data, is '$install_base/local' which breaks everything.
+ #
+ # The hack consists in using install_data instead of install_base since
+ # install_data seems to be, in practice, the proper install_base on all
+ # different systems.
+ if self.install_html is None:
+ self.install_html = os.path.join(self.install_data, 'share', 'doc', 'PyTango', 'html')
+ self.dump_dirs("Installation directories")
+
+ def has_ipython(self):
+ return IPython is not None
+
+ def has_html(self):
+ return sphinx is not None
+
+ sub_commands = list(dftinstall.sub_commands)
+ sub_commands.append(('install_spock', has_ipython))
+ sub_commands.append(('install_html', has_html))
+
+
+cmdclass['install'] = install
+
dist = setup(
name = 'PyTango',
version = Release.version,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list