Merge branch 'waf-upgrade'

This brings waf to latest and allows building with python3
Tested versions of python: 2.7.18, 3.8.7, 3.9.1
This commit is contained in:
Nedko Arnaudov 2021-02-14 21:08:57 +02:00
commit dccd4f86c7
6 changed files with 48 additions and 45 deletions

4
.gitignore vendored
View File

@ -10,8 +10,8 @@
/GRTAGS
/GSYMS
/GTAGS
/.waf-*
/.lock-wafbuild
/.waf*
/.lock-waf*
/build
*~
*.pyc

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import signal, time
@ -15,21 +15,21 @@ class level1app:
elif signum == signal.SIGINT:
self.run = False
else:
print "Unknown signal %d received" % signum
print ("Unknown signal %d received" % signum)
def run(self):
signal.signal(signal.SIGUSR1, self.sighandler)
signal.signal(signal.SIGTERM, self.sighandler)
signal.signal(signal.SIGINT, self.sighandler)
print "Waiting for signals..."
print ("Waiting for signals...")
while self.run:
if self.save:
print "Save"
print ("Save")
self.save = False
time.sleep(0.1)
print "Exit"
print ("Exit")
level1app().run()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/python3
#
# LADI Session Handler (ladish)
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/python3
#
# This file shows example usage of python bindings for LASH
# As such code here is public domain you can use it as you wish and in
@ -17,22 +17,22 @@ def lash_check_events(lash_client):
event_type = lash.lash_event_get_type(event)
if event_type == lash.LASH_Quit:
print "LASH ordered quit."
print ("LASH ordered quit.")
return False
elif event_type == lash.LASH_Save_File:
print "LASH ordered to save data in directory %s" % lash.lash_event_get_string(event)
print ("LASH ordered to save data in directory %s" % lash.lash_event_get_string(event))
lash.lash_send_event(lash_client, event)
elif event_type == lash.LASH_Save_Data_Set:
print "LASH ordered to save data"
print ("LASH ordered to save data")
lash.lash_send_event(lash_client, event)
elif event_type == lash.LASH_Restore_Data_Set:
print "LASH ordered to restore data"
print ("LASH ordered to restore data")
lash.lash_event_destroy(event)
elif event_type == lash.LASH_Restore_File:
print "LASH ordered to restore data from directory %s" % lash.lash_event_get_string(event)
print ("LASH ordered to restore data from directory %s" % lash.lash_event_get_string(event))
lash.lash_event_destroy(event)
else:
print "Got unhandled LASH event, type " + str(event_type)
print ("Got unhandled LASH event, type " + str(event_type))
lash.lash_event_destroy(event)
return True
@ -43,10 +43,10 @@ def lash_check_events(lash_client):
# sys.argv is modified by this call
lash_client = lash.init(sys.argv, "pylash test", lash.LASH_Config_Data_Set | lash.LASH_Terminal)
if not lash_client:
print "Cannot connect to LASH server"
print ("Cannot connect to LASH server")
sys.exit(1)
print "Successfully connected to LASH server at " + lash.lash_get_server_name(lash_client)
print ("Successfully connected to LASH server at " + lash.lash_get_server_name(lash_client))
# Send our client name to server
lash_event = lash.lash_event_new_with_type(lash.LASH_Client_Name)

BIN
waf vendored

Binary file not shown.

59
wscript
View File

@ -1,13 +1,8 @@
#! /usr/bin/env python
# encoding: utf-8
import os
import Options
import Utils
import shutil
import re
import waflib
from waflib.Scripting import Dist
from __future__ import with_statement
parallel_debug = False
@ -20,19 +15,24 @@ RELEASE = False
top = '.'
out = 'build'
from Logs import pprint
import os, sys, re, io, optparse, shutil, tokenize
from hashlib import md5
from waflib import Errors, Utils, Options, Logs, Scripting
from waflib import Configure
from waflib import Context
def display_msg(conf, msg="", status = None, color = None):
if status:
conf.msg(msg, status, color)
else:
pprint('NORMAL', msg)
Logs.pprint('NORMAL', msg)
def display_raw_text(conf, text, color = 'NORMAL'):
pprint(color, text, sep = '')
Logs.pprint(color, text, sep = '')
def display_line(conf, text, color = 'NORMAL'):
pprint(color, text, sep = os.linesep)
Logs.pprint(color, text, sep = os.linesep)
def yesno(bool):
if bool:
@ -55,6 +55,8 @@ def options(opt):
opt.add_option('--distsuffix', type='string', default="", help="String to append to the distribution tarball name")
opt.add_option('--tagdist', action='store_true', default=False, help='Create of git tag for distname')
opt.add_option('--libdir', type='string', default=None, help='Define lib dir')
if parallel_debug:
opt.load('parallel_debug')
@ -201,9 +203,10 @@ def configure(conf):
if build_gui:
# We need the boost headers package (e.g. libboost-dev)
# shared_ptr.hpp and weak_ptr.hpp
build_gui = conf.check_boost(
conf.check_boost(
mandatory = False,
errmsg="not found, see http://boost.org/")
build_gui = not not conf.env['BOOST_VERSION']
conf.env['BUILD_GLADISH'] = build_gui
@ -240,10 +243,10 @@ def configure(conf):
#print "optimize force enable is required"
if not check_gcc_optimizations_enabled(conf.env['CFLAGS']):
if Options.options.debug:
print "C optimization must be forced in order to enable -Wuninitialized"
print "However this will not be made because debug compilation is enabled"
print ("C optimization must be forced in order to enable -Wuninitialized")
print ("However this will not be made because debug compilation is enabled")
else:
print "C optimization forced in order to enable -Wuninitialized"
print ("C optimization forced in order to enable -Wuninitialized")
conf.env.append_unique('CFLAGS', "-O")
except:
pass
@ -273,7 +276,7 @@ def configure(conf):
version_msg = APPNAME + "-" + VERSION
if os.access('version.h', os.R_OK):
data = file('version.h').read()
data = open('version.h').read()
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
if m != None:
version_msg += " exported from " + m.group(1)
@ -319,21 +322,21 @@ def git_ver(self):
if os.access('./version.h', os.R_OK):
header = os.path.join(os.getcwd(), out, "version.h")
shutil.copy('./version.h', header)
data = file(header).read()
data = open(header).read()
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
if m != None:
self.ver = m.group(1)
pprint('BLUE', "tarball from git revision " + self.ver)
Logs.pprint('BLUE', "tarball from git revision " + self.ver)
else:
self.ver = "tarball"
return
if bld.srcnode.find_node('.git'):
self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=waflib.Context.BOTH).splitlines()[0]
if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=waflib.Context.BOTH).splitlines():
self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=Context.BOTH).splitlines()[0]
if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=Context.BOTH).splitlines():
self.ver += "-dirty"
pprint('BLUE', "git revision " + self.ver)
Logs.pprint('BLUE', "git revision " + self.ver)
else:
self.ver = "unknown"
@ -637,10 +640,10 @@ def build(bld):
# GtkBuilder UI definitions (XML)
bld.install_files('${DATA_DIR}', 'gui/gladish.ui')
bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0755)
bld.install_files('${PREFIX}/bin', 'ladish_control', chmod=0o0755)
# 'Desktop' file (menu entry, icon, etc)
bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0644)
bld.install_files('${PREFIX}/share/applications/', 'gui/gladish.desktop', chmod=0o0644)
# Icons
icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
@ -661,14 +664,14 @@ def build(bld):
html_docs_source_dir = "build/default/html"
if bld.cmd == 'clean':
if os.access(html_docs_source_dir, os.R_OK):
pprint('CYAN', "Removing doxygen generated documentation...")
Logs.pprint('CYAN', "Removing doxygen generated documentation...")
shutil.rmtree(html_docs_source_dir)
pprint('CYAN', "Removing doxygen generated documentation done.")
Logs.pprint('CYAN', "Removing doxygen generated documentation done.")
elif bld.cmd == 'build':
if not os.access(html_docs_source_dir, os.R_OK):
os.popen("doxygen").read()
else:
pprint('CYAN', "doxygen documentation already built.")
Logs.pprint('CYAN', "doxygen documentation already built.")
bld(features='intltool_po', appname=APPNAME, podir='po', install_path="${LOCALE_DIR}")
@ -701,7 +704,7 @@ def etags(ctx):
os.system(cmd)
os.system("stat -c '%y' TAGS")
class ladish_dist(waflib.Scripting.Dist):
class ladish_dist(Scripting.Dist):
cmd = 'dist'
fun = 'dist'
@ -711,7 +714,7 @@ class ladish_dist(waflib.Scripting.Dist):
self.base_name = Options.options.distname
else:
try:
self.base_name = self.cmd_and_log("LANG= git describe --tags", quiet=waflib.Context.BOTH).splitlines()[0]
self.base_name = self.cmd_and_log("LANG= git describe --tags", quiet=Context.BOTH).splitlines()[0]
except:
self.base_name = APPNAME + '-' + VERSION
self.base_name += Options.options.distsuffix