Skip to content

Commit

Permalink
#3930 use merge-update-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 28, 2023
1 parent 8bd30c8 commit 197ff0e
Show file tree
Hide file tree
Showing 56 changed files with 350 additions and 349 deletions.
34 changes: 18 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@
def write_PKG_INFO():
with open("PKG-INFO", "wb") as f:
pkg_info_values = setup_options.copy()
pkg_info_values.update({
"metadata_version" : "1.1",
"summary" : description,
"home_page" : url,
})
for k in ("Metadata-Version", "Name", "Version", "Summary", "Home-page",
"Author", "Author-email", "License", "Download-URL", "Description"):
pkg_info_values |= {
"metadata_version" : "1.1",
"summary" : description,
"home_page" : url,
}
for k in (
"Metadata-Version", "Name", "Version", "Summary", "Home-page",
"Author", "Author-email", "License", "Download-URL", "Description"
):
v = pkg_info_values[k.lower().replace("-", "_")]
f.write(("%s: %s\n" % (k, v)).encode())
write_PKG_INFO()
Expand Down Expand Up @@ -1883,11 +1885,11 @@ def addconf(name, dst_name=None):
dirtodir(f"fs/etc/xpra/{etc_dir}", f"/etc/xpra/{etc_dir}")

# add build_conf to build step
cmdclass.update({
'build' : build_override,
'build_conf' : build_conf,
'install_data' : install_data_override,
})
cmdclass |= {
'build' : build_override,
'build_conf' : build_conf,
'install_data' : install_data_override,
}

if OSX:
#pyobjc needs email.parser
Expand Down Expand Up @@ -2364,18 +2366,18 @@ def nvcc_compile(nvcc_cmd):
Options.docstrings = False
Options.buffer_max_dims = 3
if strict_ENABLED and verbose_ENABLED:
compiler_directives.update({
compiler_directives |= {
#"warn.undeclared" : True,
#"warn.maybe_uninitialized" : True,
"warn.unused" : True,
"warn.unused_result" : True,
})
}
if cython_tracing_ENABLED:
compiler_directives.update({
compiler_directives |= {
"linetrace" : True,
"binding" : True,
"profile" : True,
})
}

nthreads = int(os.environ.get("NTHREADS", 0 if (debug_ENABLED or WIN32 or OSX or ARM or RISCV) else os.cpu_count()))
setup_options["ext_modules"] = cythonize(ext_modules,
Expand Down
12 changes: 6 additions & 6 deletions xpra/audio/pulseaudio/pulseaudio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def add_audio_tagging_env(env_dict:dict=os.environ, icon_path:str="") -> None:
http://0pointer.de/blog/projects/tagging-audio.html
"""
from xpra.version_util import XPRA_VERSION
env_dict.update({
"PULSE_PROP_application.name" : "xpra",
"PULSE_PROP_application.id" : "xpra",
"PULSE_PROP_application.version" : XPRA_VERSION,
"PULSE_PROP_media.role" : "music",
})
env_dict |= {
"PULSE_PROP_application.name" : "xpra",
"PULSE_PROP_application.id" : "xpra",
"PULSE_PROP_application.version" : XPRA_VERSION,
"PULSE_PROP_media.role" : "music",
}
if not icon_path:
icon_path = default_icon_path
if icon_path and os.path.exists(icon_path):
Expand Down
4 changes: 2 additions & 2 deletions xpra/audio/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
class AudioSink(AudioPipeline):

__gsignals__ = AudioPipeline.__generic_signals__.copy()
__gsignals__.update({
__gsignals__ |= {
"eos" : one_arg_signal,
})
}

def __init__(self, sink_type=None, sink_options=None, codecs=(), codec_options=None, volume=1.0):
if not sink_type:
Expand Down
4 changes: 2 additions & 2 deletions xpra/audio/src.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
class AudioSource(AudioPipeline):

__gsignals__ = AudioPipeline.__generic_signals__.copy()
__gsignals__.update({
__gsignals__ |= {
"new-buffer" : n_arg_signal(3),
})
}

def __init__(self, src_type=None, src_options=None, codecs=(), codec_options=None, volume=1.0):
if not src_type:
Expand Down
14 changes: 6 additions & 8 deletions xpra/audio/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,13 @@ def run_audio(mode, error_cb, options, args):
"demuxers" : get_demuxers(),
}
if FULL_INFO>=1:
d.update({
"gst.version" : [int(x) for x in get_gst_version()],
})
d["gst.version"] = tuple(int(x) for x in get_gst_version())
if FULL_INFO>=2:
d.update({
"plugins" : plugins,
"python.version" : sys.version_info[:3],
"python.bits" : BITS,
})
d |= {
"plugins" : plugins,
"python.version" : sys.version_info[:3],
"python.bits" : BITS,
}
for k,v in d.items():
if isinstance(v, (list, tuple)):
v = ",".join(str(x) for x in v)
Expand Down
20 changes: 10 additions & 10 deletions xpra/client/base/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,28 +429,28 @@ def make_hello_base(self) -> dict[str,Any]:
if self.username:
#set for authentication:
capabilities["username"] = self.username
capabilities.update({
"uuid" : self.uuid,
"compression_level" : self.compression_level,
"version" : vparts(XPRA_VERSION, FULL_INFO+1),
"packet-types" : tuple(self._aliases.values()),
})
capabilities |= {
"uuid" : self.uuid,
"compression_level" : self.compression_level,
"version" : vparts(XPRA_VERSION, FULL_INFO+1),
"packet-types" : tuple(self._aliases.values()),
}
if self.display:
capabilities["display"] = self.display
if FULL_INFO>0:
capabilities.update({
capabilities |= {
"client_type" : self.client_type(),
"session-id" : self.session_id,
})
}
if FULL_INFO>1:
capabilities.update({
capabilities |= {
"python.version" : sys.version_info[:3],
"python.bits" : BITS,
"hostname" : socket.gethostname(),
"user" : get_username(),
"name" : get_name(),
"argv" : sys.argv,
})
}
capabilities.update(self.get_file_transfer_features())
def up(prefix, d):
updict(capabilities, prefix, d)
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/base/gobject_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ class ConnectTestXpraClient(CommandConnectClient):
def __init__(self, opts, **kwargs):
super().__init__(opts)
self.value = get_hex_uuid()
self.hello_extra.update({
self.hello_extra |= {
"connect_test_request" : self.value,
"request" : "connect_test",
#tells proxy servers we don't want to connect to the real / new instance:
"connect" : False,
})
}
self.hello_extra.update(kwargs)

def timeout(self, *_args):
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ def get_info(self) -> dict[str,Any]:
info = super().get_info()
tpf = self.texture_pixel_format
tif = self.internal_format
info.update({
info |= {
"type" : "OpenGL",
"bit-depth" : self.bit_depth,
"pixel-format" : self.pixel_format,
"texture-pixel-format" : CONSTANT_TO_PIXEL_FORMAT.get(tpf) or str(tpf),
"internal-format" : INTERNAL_FORMAT_TO_STR.get(tif) or str(tif),
})
}
return info


Expand Down
4 changes: 2 additions & 2 deletions xpra/client/gtk3/cairo_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def init(self, ww : int, wh : int, bw : int, bh : int) -> None:

def get_info(self) -> dict[str,Any]:
info = super().get_info()
info.update({
info |= {
"type" : "Cairo",
"rgb-formats" : self.get_rgb_formats(),
})
}
return info


Expand Down
12 changes: 6 additions & 6 deletions xpra/client/gtk3/menu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@
30 : "Low",
}
MIN_QUALITY_OPTIONS = QUALITY_OPTIONS_COMMON.copy()
MIN_QUALITY_OPTIONS.update({
MIN_QUALITY_OPTIONS | {
0 : "None",
75 : "High",
})
}
MIN_QUALITY_OPTIONS = dict(sorted(MIN_QUALITY_OPTIONS.items()))
QUALITY_OPTIONS = QUALITY_OPTIONS_COMMON.copy()
QUALITY_OPTIONS.update({
QUALITY_OPTIONS |= {
0 : "Auto",
1 : "Lowest",
90 : "Best",
100 : LOSSLESS,
})
}
QUALITY_OPTIONS = dict(sorted(QUALITY_OPTIONS.items()))


Expand All @@ -61,11 +61,11 @@
MIN_SPEED_OPTIONS[0] = "None"
MIN_SPEED_OPTIONS = dict(sorted(MIN_SPEED_OPTIONS.items()))
SPEED_OPTIONS = SPEED_OPTIONS_COMMON.copy()
SPEED_OPTIONS.update({
SPEED_OPTIONS |= {
0 : "Auto",
1 : "Lowest Bandwidth",
100 : "Lowest Latency",
})
}
SPEED_OPTIONS = dict(sorted(SPEED_OPTIONS.items()))

def get_bandwidth_menu_options():
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/gtk3/window_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ def copy_to_clipboard(self, *_args) -> None:
#backing:
b = w._backing
if b:
info.update({
info |= {
"size" : csv(b.size),
"render-size" : csv(b.render_size),
"backing-offsets" : csv(b.offsets),
})
}
text = "\n".join("%s=%s" % (k,v) for k,v in info.items())
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(text, len(text))
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/gui/client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def get_info(self) -> dict[str,Any]:
if getattr(self, "_%s" % attr.replace("-", "_"), False):
attributes.append(attr)
info = super().get_info()
info.update({
info |= {
"override-redirect" : self._override_redirect,
#"group-leader" : self.group_leader,
"position" : self._pos,
Expand All @@ -155,7 +155,7 @@ def get_info(self) -> dict[str,Any]:
"max-size" : self.max_window_size,
"button-state" : self.button_state,
"offset" : self.window_offset or (0, 0),
})
}
return info

def get_desktop_workspace(self):
Expand Down
8 changes: 4 additions & 4 deletions xpra/client/gui/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ def signal_cleanup(self) -> None:
def get_info(self) -> dict[str,Any]:
info : dict[str,Any] = {}
if FULL_INFO>0:
info.update({
info |= {
"pid" : os.getpid(),
"sys" : get_sys_info(),
"network" : get_net_info(),
"logging" : get_log_info(),
"threads" : get_frame_info(),
"env" : get_info_env(),
})
}
if SYSCONFIG:
info["sysconfig"] = get_sysconfig_info()
for c in CLIENT_BASES:
Expand Down Expand Up @@ -408,12 +408,12 @@ def make_hello(self):
):
caps[x] = True
caps.setdefault("wants", []).append("events")
caps.update({
caps |= {
#generic server flags:
"share" : self.client_supports_sharing,
"lock" : self.client_lock,
"xdg-menu" : self.start_new_commands,
})
}
caps.update(self.get_keyboard_caps())
for c in CLIENT_BASES:
caps.update(c.get_caps(self))
Expand Down
4 changes: 2 additions & 2 deletions xpra/codecs/drm/drm.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def query():
#dev_info["kms"] = kms
version = drmGetVersion(fd)
if version:
dev_info.update({
dev_info |= {
"version" : (version.version_major, version.version_minor, version.version_patchlevel),
"name" : bytestostr(version.name[:version.name_len]),
"date" : bytestostr(version.date[:version.date_len]),
"desc" : bytestostr(version.desc[:version.desc_len]),
})
}
drmFreeVersion(version)
#drmModeGetResources
except OSError as e:
Expand Down
8 changes: 4 additions & 4 deletions xpra/codecs/gstreamer/codec_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ def get_video_encoder_options(encoder:str="x264", profile:str="", options:typedi
from xpra.codecs.codec_constants import get_x264_quality, get_x264_preset
q = get_x264_quality(options.intget("quality", 50), profile)
s = options.intget("speed", 50)
eopts.update({
eopts |= {
"pass" : "qual",
"quantizer" : q,
"speed-preset" : get_x264_preset(s),
})
}
#should check for "bframes" flag in options?
return eopts

Expand Down Expand Up @@ -273,14 +273,14 @@ def get_info(self) -> dict[str,Any]:
info : dict[str,Any] = get_info()
if not self.colorspace:
return info
info.update({
info |= {
"frames" : self.frames,
"width" : self.width,
"height" : self.height,
"encoding" : self.encoding,
"colorspace": self.colorspace,
"version" : get_version(),
})
}
return info

def __repr__(self):
Expand Down
4 changes: 2 additions & 2 deletions xpra/codecs/gstreamer/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ def create_pipeline(self, options : typedict):
vcaps["profile"] = self.profile
self.extra_client_info["profile"] = self.profile
appsrc_opts = get_default_appsrc_attributes()
appsrc_opts.update({
appsrc_opts |= {
"is-live" : True,
"do-timestamp" : True,
"format" : BUFFER_FORMAT,
"caps" : CAPS,
#"leaky-type" : 0, #default is 0 and this is not available before GStreamer 1.20
})
}
gst_encoding = get_gst_encoding(self.encoding) #ie: "hevc" -> "video/x-h265"
elements = [
get_element_str("appsrc", appsrc_opts),
Expand Down
4 changes: 2 additions & 2 deletions xpra/codecs/jpeg/encoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ cdef class Encoder:

def get_info(self) -> Dict[str,Any]:
info = get_info()
info.update({
info |= {
"frames" : int(self.frames),
"encoding" : self.encoding,
"width" : self.width,
"height" : self.height,
"quality" : self.quality,
"grayscale" : bool(self.grayscale),
})
}
return info

def compress_image(self, image, options=None):
Expand Down
Loading

0 comments on commit 197ff0e

Please sign in to comment.