-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installing as a Python module proper was problematic, and was causing Zim to ignore the plugin with a lot of installation types. You could not, for example, install to /usr/local if Zim is installed to /usr. The like-named zim.plugins modules effectively shadow each other. The correct fix is to allow Zim, not Python, to manage plugins: Zim also searches $XDG_DATA_DIRS and $XDG_DATA_HOME for 3rd-party plugins. Unfortunately we cannot allow installs into $XDG_DATA_HOME due to the way DBus service activation works. Ref: http://bazaar.launchpad.net/~jaap.karssenberg/zim/pyzim/view/head:/HACKING/Writing_plugins.txt Closes #2. Also use distutils, because that is normal for a Python extension. It makes sense even if zimsearch is just data files now, although the absolute path requirement does need special handling. Remove NEWS: was blank, and distutils doesn't require it. Remove autotools machinery, and update .gitignore to deal with distutils build clutter.
- Loading branch information
Showing
10 changed files
with
114 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
Makefile | ||
Makefile.in | ||
aclocal.m4 | ||
autom4te.cache/ | ||
autoscan.log | ||
config/ | ||
config.status | ||
config.log | ||
configure | ||
/.project | ||
/.pydevproject | ||
/.settings/ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
./autogen.sh | ||
PYTHON=<path to python 2> ./configure | ||
make | ||
make install | ||
It's worth seeing where files will go first: | ||
|
||
python2 ./setup.py --dry-run install | ||
python ./setup.py --dry-run install --prefix=/usr | ||
|
||
When you're happy with the scenario, run the setup script command | ||
without --dry-run. The default installation goes in /usr/local, try | ||
this if you're unsure: | ||
|
||
python2 ./setup.py install | ||
|
||
Due to limitations of the GNOME search provider interface, this plugin | ||
must be installed into $XDG_DATA_DIRS (i.e. /usr/local/share or | ||
/usr/share). The default prefix will do this. You cannot install it | ||
sensibly into $XDG_DATA_HOME ($HOME/.local/share) because DBus service | ||
activation requires an absolute path. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...plugins.gnomeshellsearch.provider.service → ...gins.gnomeshellsearch.provider.service.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[D-BUS Service] | ||
Name=net.launchpad.zim.plugins.gnomeshellsearch.provider | ||
Exec=/usr/bin/zim --plugin gnomeshellsearch | ||
Exec=@INSTALLDIR@/bin/zim --plugin gnomeshellsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/env python2 | ||
# -*- encoding: utf-8 -*- | ||
|
||
from distutils.core import setup | ||
from distutils.command.install_data import install_data | ||
from distutils import log | ||
import os | ||
import sys | ||
import textwrap | ||
|
||
|
||
if not ((2,) < sys.version_info < (3,)): | ||
print("This program requires Python 2.x") | ||
print("Please re-run using 'python2 setup.py [...]'") | ||
sys.exit(1) | ||
|
||
|
||
# Support classes: | ||
|
||
class InstallDataSubst (install_data): | ||
"""Standard install_data command, extended for variable substitution | ||
This recognises input filenames with ".in" filename extensions, and | ||
performs some variable subsitutions on them instead of a regular | ||
copy. Subst'ed output files are written without the extension. | ||
""" | ||
# All this just because DBUS .service files require an absolute path | ||
|
||
def copy_file(self, infile, outfile, *args, **kwargs): | ||
if not infile.endswith(".in"): | ||
result = install_data.copy_file(self, infile, outfile, | ||
*args, **kwargs) | ||
else: | ||
out_basename = os.path.basename(infile) | ||
(out_basename, _) = os.path.splitext(out_basename) | ||
outfile = os.path.join(outfile, out_basename) | ||
log.info("expanding %s -> %s", infile, outfile) | ||
substs = [ | ||
("@INSTALLDIR@", self.install_dir), | ||
] | ||
log.debug("substs: %r", substs) | ||
if not self.dry_run: | ||
in_fp = open(infile, 'r') | ||
if os.path.exists(outfile): | ||
os.unlink(outfile) | ||
out_fp = open(outfile, 'w') | ||
for line in in_fp: | ||
for s, r in substs: | ||
line = line.replace(s, r) | ||
out_fp.write(line) | ||
in_fp.close() | ||
out_fp.close() | ||
result = (outfile, 1) | ||
return result | ||
|
||
|
||
# Script and GNOME search provider installation: | ||
|
||
setup( | ||
name='zimsearch', | ||
version='0.0.0', | ||
description='GNOME integration for Zim', | ||
url='https://github.com/dsboger/zimsearch', | ||
requires=["dbus"], | ||
long_description=textwrap.dedent(""" | ||
Integrates Zim into the GNOME search dialog. | ||
This plugin provides search results for GNOME Shell. | ||
""").strip(), | ||
author='Davi da Silva Böger', | ||
author_email='dsboger [at] gmail [dot] com', | ||
data_files=[ | ||
('share/zim/plugins', | ||
["src/gnomeshellsearch.py"]), | ||
('share/dbus-1/services', | ||
["data/zim.plugins.gnomeshellsearch.provider.service.in"]), | ||
('share/gnome-shell/search-providers', | ||
["data/zim.plugins.gnomeshellsearch.provider.ini.in"]), | ||
], | ||
cmdclass={'install_data': InstallDataSubst}, | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Environment :: X11 Applications :: Gnome", | ||
"Environment :: Plugins", | ||
("License :: OSI Approved :: " | ||
"GNU General Public License v2 or later (GPLv2+)"), | ||
"Intended Audience :: End Users/Desktop", | ||
"Operating System :: POSIX", | ||
"Programming Language :: Python :: 2", | ||
"Topic :: Desktop Environment", | ||
"Topic :: Utilities", | ||
] | ||
) |