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
|
||||
|
||||
from __future__ import print_function
|
||||
import subprocess
|
||||
import re
|
||||
import sys
|
||||
|
@ -7,6 +8,11 @@ import datetime
|
|||
import os
|
||||
import ConfigParser
|
||||
|
||||
try:
|
||||
long
|
||||
except NameError:
|
||||
long = int
|
||||
|
||||
distribution="yakkety"
|
||||
|
||||
versionTagRE = re.compile("^v([0-9]+((\.[0-9]+)+))(-(.+))?$")
|
||||
|
@ -123,12 +129,12 @@ def genChangeLogEntries(f, entries, distribution):
|
|||
version = upstreamVersion
|
||||
else:
|
||||
version = upstreamVersion + "~" + distribution + "1"
|
||||
print >> f, "nextcloud-client (%s) %s; urgency=medium" % (version, distribution)
|
||||
print >> f
|
||||
print >> f, " * " + subject
|
||||
print >> f
|
||||
print >> f, " -- %s <%s> %s" % (name, email, date)
|
||||
print >> f
|
||||
print("nextcloud-client (%s) %s; urgency=medium" % (version, distribution), file=f)
|
||||
print(file=f)
|
||||
print(" * " + subject, file=f)
|
||||
print(file=f)
|
||||
print(" -- %s <%s> %s" % (name, email, date), file=f)
|
||||
print(file=f)
|
||||
return (latestBaseVersion, latestKind)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -141,4 +147,4 @@ if __name__ == "__main__":
|
|||
|
||||
with open(sys.argv[1], "wt") as f:
|
||||
(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
|
||||
# along with ownCloud. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
@ -74,7 +75,7 @@ class CouldNotFindFrameworkError(Error):
|
|||
pass
|
||||
|
||||
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()
|
||||
|
||||
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)];
|
||||
|
||||
qt_version = QueryQMake('QT_VERSION')
|
||||
print "Using Qt", qt_version
|
||||
print("Using Qt", qt_version)
|
||||
|
||||
fixed_libraries = []
|
||||
fixed_frameworks = []
|
||||
|
||||
def WriteQtConf():
|
||||
print "Writing qt.conf..."
|
||||
print("Writing qt.conf...")
|
||||
with open(os.path.join(resources_dir, 'qt.conf'), 'w') as f:
|
||||
f.write("[Paths]\nPlugins = PlugIns\n");
|
||||
f.close()
|
||||
|
@ -206,7 +207,7 @@ def FixLibrary(path):
|
|||
fixed_libraries.append(path)
|
||||
abs_path = FindLibrary(path)
|
||||
if abs_path == "":
|
||||
print "Could not resolve %s, not fixing!" % path
|
||||
print("Could not resolve %s, not fixing!" % path)
|
||||
return
|
||||
broken_libs = GetBrokenLibraries(abs_path)
|
||||
FixAllLibraries(broken_libs)
|
||||
|
@ -256,7 +257,7 @@ def CopyPlugin(path, subdir):
|
|||
|
||||
def CopyFramework(source_dylib):
|
||||
parts = source_dylib.split(os.sep)
|
||||
print "CopyFramework:", source_dylib
|
||||
print("CopyFramework:", source_dylib)
|
||||
for i, part in enumerate(parts):
|
||||
matchObj = re.match(r'(\w+\.framework)', part)
|
||||
if matchObj:
|
||||
|
@ -354,9 +355,9 @@ else:
|
|||
commands.append(args)
|
||||
|
||||
if len(sys.argv) <= 2:
|
||||
print 'Will run %d commands:' % len(commands)
|
||||
print('Will run %d commands:' % len(commands))
|
||||
for command in commands:
|
||||
print ' '.join(command)
|
||||
print(' '.join(command))
|
||||
|
||||
for command in commands:
|
||||
p = subprocess.Popen(command)
|
||||
|
|
|
@ -9,6 +9,11 @@ import os
|
|||
import polib
|
||||
from optparse import OptionParser
|
||||
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-o", "--output", dest="output",
|
||||
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:
|
||||
language = localeToName[filename]
|
||||
translationCache[language] = collections.OrderedDict()
|
||||
|
||||
|
||||
po = polib.pofile(os.path.join(root,file))
|
||||
for entry in po.translated_entries():
|
||||
# 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():
|
||||
NSINewLines.append( tostr('StrCpy $%s "%s"\n' % (label,value)) )
|
||||
if language.upper() == options.lang.upper():
|
||||
NSIDeclarations.append( tostr('Var %s\n' % label) )
|
||||
NSIDeclarations.append( tostr('Var %s\n' % label) )
|
||||
|
||||
count += 1
|
||||
NSIWorkingFile = open('%s/%s.nsh' % (options.output, language),"w")
|
||||
NSIWorkingFile.writelines(NSINewLines)
|
||||
NSIWorkingFile.close()
|
||||
print ( "%i translations merged for language '%s'"%(count,language) )
|
||||
|
||||
|
||||
# Finally, let's write languages.nsh and declarations.nsh
|
||||
NSIWorkingFile = open('%s/languages.nsh' % options.output,"w")
|
||||
NSIWorkingFile.writelines(NSILanguages)
|
||||
|
@ -181,5 +186,5 @@ NSIWorkingFile.close()
|
|||
NSIWorkingFile = open('%s/declarations.nsh' % options.output,"w")
|
||||
NSIWorkingFile.writelines(NSIDeclarations)
|
||||
NSIWorkingFile.close()
|
||||
|
||||
|
||||
print ( "NSI Localization Operation Complete" )
|
||||
|
|
|
@ -296,6 +296,7 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider):
|
|||
state = entry['state']
|
||||
state_ok = state.startswith('OK')
|
||||
state_sync = state.startswith('SYNC')
|
||||
isDir = os.path.isdir(filename + os.sep)
|
||||
if state_ok:
|
||||
shareable = True
|
||||
elif state_sync and isDir:
|
||||
|
|
Loading…
Reference in New Issue