Apply patch from openSUSE for python3 compatibility
https://build.opensuse.org/package/view_file/openSUSE:Factory/ladish/ladish-python3.patch?expand=1&rev=38daa94b75ee746e0fcf3541d25f4841
This commit is contained in:
parent
297d1df722
commit
11ab9f5e6b
|
@ -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()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# LADI Session Handler (ladish)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
|
|
49
wscript
49
wscript
|
@ -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,23 @@ 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
|
||||
|
||||
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 +54,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')
|
||||
|
||||
|
@ -240,10 +241,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 +274,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,11 +320,11 @@ 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
|
||||
|
@ -333,7 +334,7 @@ def git_ver(self):
|
|||
if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=waflib.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 +638,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 +662,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 +702,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'
|
||||
|
||||
|
|
Loading…
Reference in New Issue