Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waf update #421

Merged
merged 28 commits into from
Aug 25, 2019
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e265292
upgrade waf
ederag Jun 29, 2019
cac48db
impose python3
ederag Jun 29, 2019
e6d0d5b
use Utils.O755
ederag Jun 29, 2019
9a157c0
fix data installation
ederag Jul 9, 2019
7e3831c
update GTK icon cache on install
ederag Jul 13, 2019
0b2eb08
add explicit license file for waflib
ederag Jul 13, 2019
6915088
move helper functions inside build
ederag Jul 17, 2019
7a7797b
update help/wscript
ederag Jul 21, 2019
3deeb0e
waf: separate documentation from main application
ederag Jul 27, 2019
ea522c5
doc: update dependencies
ederag Jul 27, 2019
1ab112d
Merge branch 'master' into waf-update
ederag Jul 27, 2019
2ad4c5e
waf: remove unnecessary dbus tool loading
ederag Jul 30, 2019
3dcb982
doc: installation works in 18.04 as well
ederag Jul 30, 2019
ed54143
change default prefix to /usr
ederag Aug 3, 2019
f9f3a99
cleanup: split long lines
ederag Aug 3, 2019
f98cf36
use install_path+target instead of install_path+install_files
ederag Aug 3, 2019
496e144
doc: confirm openSUSE Leap-15.1
ederag Aug 3, 2019
44d0197
remove unused prefix compatibilty line
ederag Aug 4, 2019
f3ed086
remove the /usr/etc => /etc hack
ederag Aug 4, 2019
66baf83
bypass schemas management for --docs
ederag Aug 4, 2019
3e863ba
use env. instead of .define
ederag Aug 5, 2019
45dfe88
remove PYEXECDIR
ederag Aug 5, 2019
31321d2
cleanup: remove redundant import
ederag Aug 5, 2019
2c30b22
remove --docs option
ederag Aug 5, 2019
82ea607
add uninstall instructions
ederag Aug 6, 2019
0a23d68
update NEWS
ederag Aug 6, 2019
f9187a2
add umask 0022 to installation instructions
ederag Aug 13, 2019
2649989
Merge remote-tracking branch 'upstream/master' into waf-update
ederag Aug 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
===============
Changes since v2.2.2
===============
* Fixed installation process (PR 421)
- Updated waf.
No longer need python2.
- Default to --prefix=/usr.
- gconf schemas are now correctly registered.
* Removed trophies code (PR 410)
* Used GLib.MainLoop instead of GObject.MainLoop (PR 404)
* Fixed update activity window to be resizable (PR 403)
Expand Down
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,29 @@ pgrep -af hamster

#### Dependencies

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

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

RPM-based: `yum install gettext intltool gnome-python2-gconf dbus-python`
ubuntu (tested in 19.04 and 18.04):
```bash
sudo apt install gettext intltool gconf2 gir1.2-gconf-2.0 python3-gi-cairo
sudo apt install gnome-doc-utils yelp
```


##### openSUSE

Leap-15.0 and Leap-15.1:
```bash
sudo zypper install intltool python3-pyxdg python3-cairo python3-gobject-Gdk
sudo zypper install gnome-doc-utils xml2po yelp
```

##### RPM-based

*RPM-based instructions below should be updated for python3 (issue [#369](https://github.com/projecthamster/hamster/issues/369)).*

`yum install gettext intltool gnome-python2-gconf dbus-python`

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

#### Building and installing

To install, python2 is still necessary (for waf).
[Adapt](https://github.com/projecthamster/hamster/issues/221#issuecomment-462094920) the paths below to your system,
`sudo rm/mv` commands, beware !
```
./waf configure && ./waf clean && ./waf distclean # important for the help pages
./waf configure build --prefix=/usr && sudo ./waf install
sudo rm -rf /usr/lib/python3.6/site-packages/hamster
sudo mv /usr/lib/python2.7/site-packages/hamster /usr/lib/python3.6/site-packages/
```bash
./waf configure build
sudo ./waf install
```

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


#### Uninstall

```bash
./waf configure
sudo ./waf uninstall
```


#### Migrating from hamster-applet

Previously Hamster was installed everywhere under `hamster-applet`. As
Expand Down
16 changes: 9 additions & 7 deletions data/wscript_build
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python2
# encoding: utf-8
# This file is meant to be included in the root wscript,
# through the recurse("data") command

bld.install_files('${DATADIR}/hamster-time-tracker', '*.ui')
start_dir = bld.path.find_dir('.')
bld.install_files('${DATADIR}/hamster-time-tracker', start_dir.ant_glob('*.ui'))
bld.install_files('${DATADIR}/hamster-time-tracker', 'hamster.db')
bld.install_files('${DATADIR}/hamster-time-tracker/art', 'art/*.png')
bld.install_files('${DATADIR}/hamster-time-tracker/art', start_dir.ant_glob('art/*.png'))
bld.install_files('${DATADIR}/hamster-time-tracker', 'report_template.html')

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

bld(features = 'intltool_in',
source = """hamster-time-tracker-overview.desktop.in
hamster-time-tracker.desktop.in
hamster-windows-service.desktop.in""",
install_path = '${DATADIR}/applications',
podir = '../po',
flags = ['-d', '-q', '-u', '-c'])
flags = ['-d', '-q', '-u'])
60 changes: 32 additions & 28 deletions help/wscript
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python2
# waf script called from the root wscript, by
# conf.recurse("help")

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

## Mallard functionality definitions ##
import os
import Task
import TaskGen
from waflib import Logs, TaskGen

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

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

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

# Check if the declared page list is consistent
declared_pages = self.to_list(bld.env["DOC_PAGES"])
missing_pages = set(pages).difference(declared_pages)
if missing_pages:
print "Warning: Some pages not declared:"
print "\n".join(missing_pages)
print("Warning: Some pages not declared:")
print("\n".join(missing_pages))

install_path = lambda lang: os.path.join(bld.env.DATADIR, "help", lang, "${DOC_ID}")

for lang in lst:
node = self.path.find_resource("%s/%s.po" % (lang, lang))
for page in pages:
tsk = self.create_task('xml2po')
out = self.path.find_or_declare('%s/%s' % (lang, page))
src = self.path.find_resource('C/%s' % page)
tsk.set_inputs([node,src])
tsk.set_outputs(out)
tsk.install_path = os.path.join(self.install_path, lang, "${DOC_ID}")
bld(name='xml2po', color='BLUE',
rule='${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',
source=[node, src],
target=out,
install_path=install_path(lang)
)

if bld.is_install:
for page in pages:
out = "%s/%s" % (cnode.abspath(), page)
instdir = os.path.join(self.install_path, "C", "${DOC_ID}")
bld.install_files(instdir, out)
page_nodes = [cnode.find_resource(page) for page in pages]
instdir = install_path("C")
bld.install_files(instdir, page_nodes)

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

TaskGen.feature("mallard")(init_mallard)
TaskGen.feature("mallard")(apply_mallard)
Expand All @@ -72,16 +72,20 @@ TaskGen.after('init_mallard')(apply_mallard)

# Build Configuration

def set_options(opt):
pass

def configure(conf):
xml2po = conf.find_program('xml2po', var='XML2PO')
conf.env['XML2POFLAGS'] = '-mmallard -p'
def configure(ctx):
lookfor = "xml2po"
try:
ctx.find_program(lookfor, var='XML2PO')
ctx.env.docs = True
ctx.env.XML2POFLAGS = '-mmallard -p'
except ctx.errors.ConfigurationError:
Logs.warn("'{}' not found; documentation build disabled".format(lookfor))
ctx.env.docs = False

def build(bld):
if bld.env["XML2PO"]:
task = bld.new_task_gen(
def build(ctx):
if ctx.env.docs:
task = ctx(
features="mallard",
variable_definitions="Makefile.am",
)
2 changes: 1 addition & 1 deletion src/hamster/defs.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ DATA_DIR = "@DATADIR@"
LIB_DIR = "@LIBDIR@"
VERSION = "@VERSION@"
PACKAGE = "@PACKAGE@"
PYTHONDIR = "@PYEXECDIR@"
PYTHONDIR = "@PYTHONDIR@"
2 changes: 1 addition & 1 deletion waf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# encoding: latin-1
# Thomas Nagy, 2005-2018
#
Expand Down
25 changes: 25 additions & 0 deletions waflib/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Loading