Skip to content

Commit

Permalink
Bundle zeroconf instead of downloading at build time.
Browse files Browse the repository at this point in the history
Bump to the latest version also, seems to work without issues.
  • Loading branch information
mtwebster committed Oct 16, 2023
1 parent 53d3bd1 commit 6bead39
Show file tree
Hide file tree
Showing 91 changed files with 21,500 additions and 74 deletions.
49 changes: 0 additions & 49 deletions install-scripts/download_zeroconf.py

This file was deleted.

5 changes: 0 additions & 5 deletions install-scripts/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,3 @@ meson.add_install_script('meson_install_schemas.py')

# Update the Gtk icon cache
meson.add_install_script('meson_update_icon_cache.py')

# Flatpak already bundles.
if bundle_zeroconf and not get_option('flatpak-build')
meson.add_install_script('download_zeroconf.py')
endif
2 changes: 1 addition & 1 deletion src/grpcio-1.59.0/build_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
srcdir = sys.argv[1]
outdir = sys.argv[2]

print("Building grpc s:%s, t:%s" % (srcdir, outdir))
print("Building grpc s:%s, t:%s" % (srcdir, outdir), flush=True)

# Modifications to grpc tarball (1.59.0) #################################################################

Expand Down
11 changes: 11 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if bundle_grpc
dependency('python3')
current_grpc_version = '1.59.0'
current_protobuf_version = '4.24.4'
current_zeroconf_version = '0.115.2'

setup = join_paths(meson_source_root, 'grpcio-' + current_grpc_version, 'build_script.py')

Expand All @@ -85,6 +86,16 @@ if bundle_grpc
install_dir: install_libdir,
build_by_default: true,
)

setup = join_paths(meson_source_root, 'zeroconf-' + current_zeroconf_version, 'build_script.py')

grpc = custom_target('zeroconf_build',
output: 'zeroconf',
command: [setup, join_paths(meson_source_root, 'zeroconf-' + current_zeroconf_version), join_paths(meson.current_build_dir(), 'zeroconf')],
install: true,
install_dir: install_libdir,
build_by_default: true,
)
endif

if bundle_landlock
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf-4.24.4/build_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
srcdir = sys.argv[1]
outdir = sys.argv[2]

print("Building protobuf s:%s, t:%s" % (srcdir, outdir))
print("Building protobuf s:%s, t:%s" % (srcdir, outdir), flush=True)

try:
os.chdir(srcdir)
Expand Down
21 changes: 3 additions & 18 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,8 @@
from ops import ReceiveOp
from util import TransferDirection, OpStatus, RemoteStatus

try:
import zeroconf_
from zeroconf_ import ServiceInfo, Zeroconf, ServiceBrowser
except:
import zeroconf

zc_version = pkg_resources.parse_version(zeroconf.__version__)
zc_min_version = pkg_resources.parse_version("0.27.0")

if zc_version < zc_min_version:
print("Python3 zeroconf must be >= %s" % zc_min_version)
exit(1)

from zeroconf import ServiceInfo, Zeroconf, ServiceBrowser
import zeroconf
from zeroconf import ServiceInfo, Zeroconf, ServiceBrowser

_ = gettext.gettext

Expand Down Expand Up @@ -89,10 +77,7 @@ def __init__(self, ip_info, port, auth_port):
self.start()

def start_zeroconf(self):
try:
logging.info("Using bundled zeroconf v%s" % zeroconf_.__version__)
except:
logging.info("Using system zeroconf v%s" % zeroconf.__version__)
logging.info("Using zeroconf version %s %s" % (zeroconf.__version__, "(bundled)" if config.bundle_zeroconf else ""))

self.zeroconf = Zeroconf(interfaces=[self.ip_info.ip4_address])

Expand Down
Loading

0 comments on commit 6bead39

Please sign in to comment.