Use print() function in both Python 2 and Python 3
Signed-off-by: cclauss <cclauss@me.com>
This commit is contained in:
parent
5ef08a51b2
commit
b34ed01109
|
@ -1,5 +1,6 @@
|
||||||
#!//usr/bin/env python2.7
|
#!//usr/bin/env python2.7
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -7,6 +8,11 @@ import datetime
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
|
try:
|
||||||
|
long
|
||||||
|
except NameError:
|
||||||
|
long = int
|
||||||
|
|
||||||
distribution="yakkety"
|
distribution="yakkety"
|
||||||
|
|
||||||
versionTagRE = re.compile("^v([0-9]+((\.[0-9]+)+))(-(.+))?$")
|
versionTagRE = re.compile("^v([0-9]+((\.[0-9]+)+))(-(.+))?$")
|
||||||
|
@ -123,12 +129,12 @@ def genChangeLogEntries(f, entries, distribution):
|
||||||
version = upstreamVersion
|
version = upstreamVersion
|
||||||
else:
|
else:
|
||||||
version = upstreamVersion + "~" + distribution + "1"
|
version = upstreamVersion + "~" + distribution + "1"
|
||||||
print >> f, "nextcloud-client (%s) %s; urgency=medium" % (version, distribution)
|
print("nextcloud-client (%s) %s; urgency=medium" % (version, distribution), file=f)
|
||||||
print >> f
|
print(file=f)
|
||||||
print >> f, " * " + subject
|
print(" * " + subject, file=f)
|
||||||
print >> f
|
print(file=f)
|
||||||
print >> f, " -- %s <%s> %s" % (name, email, date)
|
print(" -- %s <%s> %s" % (name, email, date), file=f)
|
||||||
print >> f
|
print(file=f)
|
||||||
return (latestBaseVersion, latestKind)
|
return (latestBaseVersion, latestKind)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -141,4 +147,4 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
with open(sys.argv[1], "wt") as f:
|
with open(sys.argv[1], "wt") as f:
|
||||||
(baseVersion, kind) = genChangeLogEntries(f, entries, distribution)
|
(baseVersion, kind) = genChangeLogEntries(f, entries, distribution)
|
||||||
print baseVersion, kind
|
print(baseVersion, kind)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with ownCloud. If not, see <http://www.gnu.org/licenses/>.
|
# along with ownCloud. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -74,7 +75,7 @@ class CouldNotFindFrameworkError(Error):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
print 'Usage: %s <bundle.app> <path-to-qmake>' % sys.argv[0]
|
print('Usage: %s <bundle.app> <path-to-qmake>' % sys.argv[0])
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
def is_exe(fpath):
|
def is_exe(fpath):
|
||||||
|
@ -96,13 +97,13 @@ plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns')
|
||||||
binaries = [i for i in glob(os.path.join(bundle_dir, 'Contents', 'MacOS', "*")) if is_exe(i)];
|
binaries = [i for i in glob(os.path.join(bundle_dir, 'Contents', 'MacOS', "*")) if is_exe(i)];
|
||||||
|
|
||||||
qt_version = QueryQMake('QT_VERSION')
|
qt_version = QueryQMake('QT_VERSION')
|
||||||
print "Using Qt", qt_version
|
print("Using Qt", qt_version)
|
||||||
|
|
||||||
fixed_libraries = []
|
fixed_libraries = []
|
||||||
fixed_frameworks = []
|
fixed_frameworks = []
|
||||||
|
|
||||||
def WriteQtConf():
|
def WriteQtConf():
|
||||||
print "Writing qt.conf..."
|
print("Writing qt.conf...")
|
||||||
with open(os.path.join(resources_dir, 'qt.conf'), 'w') as f:
|
with open(os.path.join(resources_dir, 'qt.conf'), 'w') as f:
|
||||||
f.write("[Paths]\nPlugins = PlugIns\n");
|
f.write("[Paths]\nPlugins = PlugIns\n");
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -206,7 +207,7 @@ def FixLibrary(path):
|
||||||
fixed_libraries.append(path)
|
fixed_libraries.append(path)
|
||||||
abs_path = FindLibrary(path)
|
abs_path = FindLibrary(path)
|
||||||
if abs_path == "":
|
if abs_path == "":
|
||||||
print "Could not resolve %s, not fixing!" % path
|
print("Could not resolve %s, not fixing!" % path)
|
||||||
return
|
return
|
||||||
broken_libs = GetBrokenLibraries(abs_path)
|
broken_libs = GetBrokenLibraries(abs_path)
|
||||||
FixAllLibraries(broken_libs)
|
FixAllLibraries(broken_libs)
|
||||||
|
@ -256,7 +257,7 @@ def CopyPlugin(path, subdir):
|
||||||
|
|
||||||
def CopyFramework(source_dylib):
|
def CopyFramework(source_dylib):
|
||||||
parts = source_dylib.split(os.sep)
|
parts = source_dylib.split(os.sep)
|
||||||
print "CopyFramework:", source_dylib
|
print("CopyFramework:", source_dylib)
|
||||||
for i, part in enumerate(parts):
|
for i, part in enumerate(parts):
|
||||||
matchObj = re.match(r'(\w+\.framework)', part)
|
matchObj = re.match(r'(\w+\.framework)', part)
|
||||||
if matchObj:
|
if matchObj:
|
||||||
|
@ -354,9 +355,9 @@ else:
|
||||||
commands.append(args)
|
commands.append(args)
|
||||||
|
|
||||||
if len(sys.argv) <= 2:
|
if len(sys.argv) <= 2:
|
||||||
print 'Will run %d commands:' % len(commands)
|
print('Will run %d commands:' % len(commands))
|
||||||
for command in commands:
|
for command in commands:
|
||||||
print ' '.join(command)
|
print(' '.join(command))
|
||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
p = subprocess.Popen(command)
|
p = subprocess.Popen(command)
|
||||||
|
|
|
@ -9,6 +9,11 @@ import os
|
||||||
import polib
|
import polib
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
try:
|
||||||
|
unicode
|
||||||
|
except NameError:
|
||||||
|
unicode = str
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-o", "--output", dest="output",
|
parser.add_option("-o", "--output", dest="output",
|
||||||
help="Directory for localized output", default="../Shared/installer/nightly_localized.nsi")
|
help="Directory for localized output", default="../Shared/installer/nightly_localized.nsi")
|
||||||
|
@ -126,7 +131,7 @@ for root,dirs,files in os.walk(options.podir):
|
||||||
if filename in localeToName:
|
if filename in localeToName:
|
||||||
language = localeToName[filename]
|
language = localeToName[filename]
|
||||||
translationCache[language] = collections.OrderedDict()
|
translationCache[language] = collections.OrderedDict()
|
||||||
|
|
||||||
po = polib.pofile(os.path.join(root,file))
|
po = polib.pofile(os.path.join(root,file))
|
||||||
for entry in po.translated_entries():
|
for entry in po.translated_entries():
|
||||||
# Loop through all our labels and add translation (each translation may have multiple labels)
|
# Loop through all our labels and add translation (each translation may have multiple labels)
|
||||||
|
@ -165,14 +170,14 @@ for language,translations in translationCache.iteritems():
|
||||||
for label,value in translations.iteritems():
|
for label,value in translations.iteritems():
|
||||||
NSINewLines.append( tostr('StrCpy $%s "%s"\n' % (label,value)) )
|
NSINewLines.append( tostr('StrCpy $%s "%s"\n' % (label,value)) )
|
||||||
if language.upper() == options.lang.upper():
|
if language.upper() == options.lang.upper():
|
||||||
NSIDeclarations.append( tostr('Var %s\n' % label) )
|
NSIDeclarations.append( tostr('Var %s\n' % label) )
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
NSIWorkingFile = open('%s/%s.nsh' % (options.output, language),"w")
|
NSIWorkingFile = open('%s/%s.nsh' % (options.output, language),"w")
|
||||||
NSIWorkingFile.writelines(NSINewLines)
|
NSIWorkingFile.writelines(NSINewLines)
|
||||||
NSIWorkingFile.close()
|
NSIWorkingFile.close()
|
||||||
print ( "%i translations merged for language '%s'"%(count,language) )
|
print ( "%i translations merged for language '%s'"%(count,language) )
|
||||||
|
|
||||||
# Finally, let's write languages.nsh and declarations.nsh
|
# Finally, let's write languages.nsh and declarations.nsh
|
||||||
NSIWorkingFile = open('%s/languages.nsh' % options.output,"w")
|
NSIWorkingFile = open('%s/languages.nsh' % options.output,"w")
|
||||||
NSIWorkingFile.writelines(NSILanguages)
|
NSIWorkingFile.writelines(NSILanguages)
|
||||||
|
@ -181,5 +186,5 @@ NSIWorkingFile.close()
|
||||||
NSIWorkingFile = open('%s/declarations.nsh' % options.output,"w")
|
NSIWorkingFile = open('%s/declarations.nsh' % options.output,"w")
|
||||||
NSIWorkingFile.writelines(NSIDeclarations)
|
NSIWorkingFile.writelines(NSIDeclarations)
|
||||||
NSIWorkingFile.close()
|
NSIWorkingFile.close()
|
||||||
|
|
||||||
print ( "NSI Localization Operation Complete" )
|
print ( "NSI Localization Operation Complete" )
|
||||||
|
|
|
@ -296,6 +296,7 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider):
|
||||||
state = entry['state']
|
state = entry['state']
|
||||||
state_ok = state.startswith('OK')
|
state_ok = state.startswith('OK')
|
||||||
state_sync = state.startswith('SYNC')
|
state_sync = state.startswith('SYNC')
|
||||||
|
isDir = os.path.isdir(filename + os.sep)
|
||||||
if state_ok:
|
if state_ok:
|
||||||
shareable = True
|
shareable = True
|
||||||
elif state_sync and isDir:
|
elif state_sync and isDir:
|
||||||
|
|
Loading…
Reference in New Issue