Skip to content

Commit d15555e

Browse files
authored
Merge pull request #421 from ederag/waf-update
waf update
2 parents 53d4ec3 + 2649989 commit d15555e

File tree

218 files changed

+41246
-7132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+41246
-7132
lines changed

NEWS

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
===============
22
Changes since v2.2.2
33
===============
4+
* Fixed installation process (PR 421)
5+
- Updated waf.
6+
No longer need python2.
7+
- Default to --prefix=/usr.
8+
- gconf schemas are now correctly registered.
49
* Removed trophies code (PR 410)
510
* Used GLib.MainLoop instead of GObject.MainLoop (PR 404)
611
* Fixed update activity window to be resizable (PR 403)

README.md

+36-11
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,29 @@ pgrep -af hamster
4040

4141
#### Dependencies
4242

43-
openSUSE Leap-15: `zypper install intltool python3-pyxdg python3-cairo python3-gobject-Gdk`
4443

45-
Debian-based: [detailed instructions](https://github.com/projecthamster/hamster/wiki/Hamster-2.x-on-Xubuntu-18.04).
44+
##### Debian-based
4645

47-
RPM-based: `yum install gettext intltool gnome-python2-gconf dbus-python`
46+
ubuntu (tested in 19.04 and 18.04):
47+
```bash
48+
sudo apt install gettext intltool gconf2 gir1.2-gconf-2.0 python3-gi-cairo
49+
sudo apt install gnome-doc-utils yelp
50+
```
51+
52+
53+
##### openSUSE
54+
55+
Leap-15.0 and Leap-15.1:
56+
```bash
57+
sudo zypper install intltool python3-pyxdg python3-cairo python3-gobject-Gdk
58+
sudo zypper install gnome-doc-utils xml2po yelp
59+
```
60+
61+
##### RPM-based
62+
63+
*RPM-based instructions below should be updated for python3 (issue [#369](https://github.com/projecthamster/hamster/issues/369)).*
64+
65+
`yum install gettext intltool gnome-python2-gconf dbus-python`
4866

4967
If the hamster help pages are not accessible ("unable to open `help:hamster-time-tracker`"),
5068
then a [Mallard](https://en.wikipedia.org/wiki/Mallard_(documentation))-capable help reader is required,
@@ -68,18 +86,25 @@ src/hamster-cli
6886

6987
#### Building and installing
7088

71-
To install, python2 is still necessary (for waf).
72-
[Adapt](https://github.com/projecthamster/hamster/issues/221#issuecomment-462094920) the paths below to your system,
73-
`sudo rm/mv` commands, beware !
74-
```
75-
./waf configure && ./waf clean && ./waf distclean # important for the help pages
76-
./waf configure build --prefix=/usr && sudo ./waf install
77-
sudo rm -rf /usr/lib/python3.6/site-packages/hamster
78-
sudo mv /usr/lib/python2.7/site-packages/hamster /usr/lib/python3.6/site-packages/
89+
```bash
90+
./waf configure build
91+
# thanks to the parentheses the umask of your shell will not be changed
92+
( umask 0022 && sudo ./waf install; )
7993
```
94+
The `umask 0022` is safe for all, but important for users with more restrictive umask,
95+
as discussed [here](https://github.com/projecthamster/hamster/pull/421#issuecomment-520167143).
8096

8197
Now restart your panels/docks and you should be able to add Hamster!
8298

99+
100+
#### Uninstall
101+
102+
```bash
103+
./waf configure
104+
sudo ./waf uninstall
105+
```
106+
107+
83108
#### Migrating from hamster-applet
84109

85110
Previously Hamster was installed everywhere under `hamster-applet`. As

data/wscript_build

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#!/usr/bin/env python2
2-
# encoding: utf-8
1+
# This file is meant to be included in the root wscript,
2+
# through the recurse("data") command
33

4-
bld.install_files('${DATADIR}/hamster-time-tracker', '*.ui')
4+
start_dir = bld.path.find_dir('.')
5+
bld.install_files('${DATADIR}/hamster-time-tracker', start_dir.ant_glob('*.ui'))
56
bld.install_files('${DATADIR}/hamster-time-tracker', 'hamster.db')
6-
bld.install_files('${DATADIR}/hamster-time-tracker/art', 'art/*.png')
7+
bld.install_files('${DATADIR}/hamster-time-tracker/art', start_dir.ant_glob('art/*.png'))
78
bld.install_files('${DATADIR}/hamster-time-tracker', 'report_template.html')
89

910
bld.install_files('${DATADIR}/icons/hicolor/16x16/apps', 'art/16x16/hamster-time-tracker.png')
@@ -28,14 +29,15 @@ bld.add_group()
2829
# process .in files with intl_tool
2930
bld(features = 'intltool_in',
3031
source = 'hamster-time-tracker.schemas.in',
31-
install_path = '${SYSCONFDIR}/gconf/schemas',
32+
target = 'hamster-time-tracker.schemas',
33+
install_path = bld.env.schemas_destination,
3234
podir = '../po',
33-
flags = ['-s', '-u', '-c'])
35+
flags = ['-s', '-u'])
3436

3537
bld(features = 'intltool_in',
3638
source = """hamster-time-tracker-overview.desktop.in
3739
hamster-time-tracker.desktop.in
3840
hamster-windows-service.desktop.in""",
3941
install_path = '${DATADIR}/applications',
4042
podir = '../po',
41-
flags = ['-d', '-q', '-u', '-c'])
43+
flags = ['-d', '-q', '-u'])

help/wscript

+32-28
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/usr/bin/env python2
1+
# waf script called from the root wscript, by
2+
# conf.recurse("help")
23

34
# Mallard waf adaptor written by Ulrik Sverdrup
45
# may be distributed, changed, used, etc freely for any purpose
56

67
## Mallard functionality definitions ##
78
import os
8-
import Task
9-
import TaskGen
9+
from waflib import Logs, TaskGen
1010

1111
def _read_makefile_am(filename):
1212
"read a Makefile.am file for DOC_* variable definitions, return a dict"
@@ -23,8 +23,8 @@ def init_mallard(self):
2323
have_vars = set(var for var in DOC_VAR if DOC_VAR[var])
2424
missing_vars = set(require_vars).difference(have_vars)
2525
if missing_vars:
26-
print "Missing DOC variable declarations in %s:" % (mf_am.abspath())
27-
print "\n".join(missing_vars)
26+
print("Missing DOC variable declarations in {}:".format(mf_am.abspath()))
27+
print("\n".join(missing_vars))
2828

2929
self.bld.env.update(DOC_VAR)
3030
self.default_install_path='${PREFIX}/share/help'
@@ -33,35 +33,35 @@ def apply_mallard(self):
3333
bld = self.bld
3434
lst = self.to_list(bld.env["DOC_LINGUAS"])
3535
cnode = self.path.find_dir("C")
36-
self.bld.rescan(cnode)
3736

38-
pages = [p for p in self.bld.cache_dir_contents[cnode.id]
39-
if (os.path.splitext(p)[-1].lower()) == ".page"]
37+
pages = [p.name for p in cnode.ant_glob("*.page")]
4038

4139
# Check if the declared page list is consistent
4240
declared_pages = self.to_list(bld.env["DOC_PAGES"])
4341
missing_pages = set(pages).difference(declared_pages)
4442
if missing_pages:
45-
print "Warning: Some pages not declared:"
46-
print "\n".join(missing_pages)
43+
print("Warning: Some pages not declared:")
44+
print("\n".join(missing_pages))
45+
46+
install_path = lambda lang: os.path.join(bld.env.DATADIR, "help", lang, "${DOC_ID}")
4747

4848
for lang in lst:
4949
node = self.path.find_resource("%s/%s.po" % (lang, lang))
5050
for page in pages:
51-
tsk = self.create_task('xml2po')
5251
out = self.path.find_or_declare('%s/%s' % (lang, page))
5352
src = self.path.find_resource('C/%s' % page)
54-
tsk.set_inputs([node,src])
55-
tsk.set_outputs(out)
56-
tsk.install_path = os.path.join(self.install_path, lang, "${DOC_ID}")
53+
bld(name='xml2po', color='BLUE',
54+
rule='${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',
55+
source=[node, src],
56+
target=out,
57+
install_path=install_path(lang)
58+
)
59+
5760
if bld.is_install:
58-
for page in pages:
59-
out = "%s/%s" % (cnode.abspath(), page)
60-
instdir = os.path.join(self.install_path, "C", "${DOC_ID}")
61-
bld.install_files(instdir, out)
61+
page_nodes = [cnode.find_resource(page) for page in pages]
62+
instdir = install_path("C")
63+
bld.install_files(instdir, page_nodes)
6264

63-
Task.simple_task_type('xml2po', '${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',
64-
color='BLUE')
6565

6666
TaskGen.feature("mallard")(init_mallard)
6767
TaskGen.feature("mallard")(apply_mallard)
@@ -72,16 +72,20 @@ TaskGen.after('init_mallard')(apply_mallard)
7272

7373
# Build Configuration
7474

75-
def set_options(opt):
76-
pass
7775

78-
def configure(conf):
79-
xml2po = conf.find_program('xml2po', var='XML2PO')
80-
conf.env['XML2POFLAGS'] = '-mmallard -p'
76+
def configure(ctx):
77+
lookfor = "xml2po"
78+
try:
79+
ctx.find_program(lookfor, var='XML2PO')
80+
ctx.env.docs = True
81+
ctx.env.XML2POFLAGS = '-mmallard -p'
82+
except ctx.errors.ConfigurationError:
83+
Logs.warn("'{}' not found; documentation build disabled".format(lookfor))
84+
ctx.env.docs = False
8185

82-
def build(bld):
83-
if bld.env["XML2PO"]:
84-
task = bld.new_task_gen(
86+
def build(ctx):
87+
if ctx.env.docs:
88+
task = ctx(
8589
features="mallard",
8690
variable_definitions="Makefile.am",
8791
)

src/hamster/defs.py.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ DATA_DIR = "@DATADIR@"
22
LIB_DIR = "@LIBDIR@"
33
VERSION = "@VERSION@"
44
PACKAGE = "@PACKAGE@"
5-
PYTHONDIR = "@PYEXECDIR@"
5+
PYTHONDIR = "@PYTHONDIR@"

0 commit comments

Comments
 (0)