Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 613396 | Differences between
and this patch

Collapse All | Expand All

(-)spyder-3.2.3.orig/setup.py (-105 / +2 lines)
Lines 77-89 Link Here
77
def get_data_files():
77
def get_data_files():
78
    """Return data_files in a platform dependent manner"""
78
    """Return data_files in a platform dependent manner"""
79
    if sys.platform.startswith('linux'):
79
    if sys.platform.startswith('linux'):
80
        if PY3:
80
        data_files = [('share/pixmaps', ['img_src/spyder.png'])]
81
            data_files = [('share/applications', ['scripts/spyder3.desktop']),
82
                          ('share/pixmaps', ['img_src/spyder3.png']),
83
                          ('share/metainfo', ['scripts/spyder3.appdata.xml'])]
84
        else:
85
            data_files = [('share/applications', ['scripts/spyder.desktop']),
86
                          ('share/pixmaps', ['img_src/spyder.png'])]
87
    elif os.name == 'nt':
81
    elif os.name == 'nt':
88
        data_files = [('scripts', ['img_src/spyder.ico',
82
        data_files = [('scripts', ['img_src/spyder.ico',
89
                                   'img_src/spyder_reset.ico'])]
83
                                   'img_src/spyder_reset.ico'])]
Lines 106-207 Link Here
106
100
107
101
108
#==============================================================================
102
#==============================================================================
109
# Make Linux detect Spyder desktop file
110
#==============================================================================
111
class MyInstallData(install_data):
112
    def run(self):
113
        install_data.run(self)
114
        if sys.platform.startswith('linux'):
115
            try:
116
                subprocess.call(['update-desktop-database'])
117
            except:
118
                print("ERROR: unable to update desktop database",
119
                      file=sys.stderr)
120
CMDCLASS = {'install_data': MyInstallData}
121
122
123
#==============================================================================
124
# Sphinx build (documentation)
125
#==============================================================================
126
def get_html_help_exe():
127
    """Return HTML Help Workshop executable path (Windows only)"""
128
    if os.name == 'nt':
129
        hhc_base = r'C:\Program Files%s\HTML Help Workshop\hhc.exe'
130
        for hhc_exe in (hhc_base % '', hhc_base % ' (x86)'):
131
            if osp.isfile(hhc_exe):
132
                return hhc_exe
133
        else:
134
            return
135
136
try:
137
    from sphinx import setup_command
138
139
    class MyBuild(build):
140
        user_options = [('no-doc', None, "Don't build Spyder documentation")] \
141
                       + build.user_options
142
        def __init__(self, *args, **kwargs):
143
            build.__init__(self, *args, **kwargs)
144
            self.no_doc = False
145
        def with_doc(self):
146
            setup_dir = os.path.dirname(os.path.abspath(__file__))
147
            is_doc_dir = os.path.isdir(os.path.join(setup_dir, 'doc'))
148
            install_obj = self.distribution.get_command_obj('install')
149
            return (is_doc_dir and not self.no_doc and not install_obj.no_doc)
150
        sub_commands = build.sub_commands + [('build_doc', with_doc)]
151
    CMDCLASS['build'] = MyBuild
152
153
154
    class MyInstall(install):
155
        user_options = [('no-doc', None, "Don't build Spyder documentation")] \
156
                       + install.user_options
157
        def __init__(self, *args, **kwargs):
158
            install.__init__(self, *args, **kwargs)
159
            self.no_doc = False
160
    CMDCLASS['install'] = MyInstall
161
162
163
    class MyBuildDoc(setup_command.BuildDoc):
164
        def run(self):
165
            build = self.get_finalized_command('build')
166
            sys.path.insert(0, os.path.abspath(build.build_lib))
167
            dirname = self.distribution.get_command_obj('build').build_purelib
168
            self.builder_target_dir = osp.join(dirname, 'spyder', 'doc')
169
170
            if not osp.exists(self.builder_target_dir):
171
                os.mkdir(self.builder_target_dir)
172
173
            hhc_exe = get_html_help_exe()
174
            self.builder = "html" if hhc_exe is None else "htmlhelp"
175
176
            try:
177
                setup_command.BuildDoc.run(self)
178
            except UnicodeDecodeError:
179
                print("ERROR: unable to build documentation because Sphinx "\
180
                      "do not handle source path with non-ASCII characters. "\
181
                      "Please try to move the source package to another "\
182
                      "location (path with *only* ASCII characters).",
183
                      file=sys.stderr)
184
            sys.path.pop(0)
185
186
            # Building chm doc, if HTML Help Workshop is installed
187
            if hhc_exe is not None:
188
                fname = osp.join(self.builder_target_dir, 'Spyderdoc.chm')
189
                subprocess.call('"%s" %s' % (hhc_exe, fname), shell=True)
190
                if osp.isfile(fname):
191
                    dest = osp.join(dirname, 'spyder')
192
                    try:
193
                        shutil.move(fname, dest)
194
                    except shutil.Error:
195
                        print("Unable to replace %s" % dest)
196
                    shutil.rmtree(self.builder_target_dir)
197
198
    CMDCLASS['build_doc'] = MyBuildDoc
199
except ImportError:
200
    print('WARNING: unable to build documentation because Sphinx '\
201
          'is not installed', file=sys.stderr)
202
203
204
#==============================================================================
205
# Main scripts
103
# Main scripts
206
#==============================================================================
104
#==============================================================================
207
# NOTE: the '[...]_win_post_install.py' script is installed even on non-Windows
105
# NOTE: the '[...]_win_post_install.py' script is installed even on non-Windows
Lines 261-268 Link Here
261
                   'Programming Language :: Python :: 3',
159
                   'Programming Language :: Python :: 3',
262
                   'Development Status :: 5 - Production/Stable',
160
                   'Development Status :: 5 - Production/Stable',
263
                   'Topic :: Scientific/Engineering',
161
                   'Topic :: Scientific/Engineering',
264
                   'Topic :: Software Development :: Widget Sets'],
162
                   'Topic :: Software Development :: Widget Sets'])
265
      cmdclass=CMDCLASS)
266
163
267
164
268
#==============================================================================
165
#==============================================================================

Return to bug 613396