From 63dc7e9517968f315b95ac0c445b9668b77de794 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 6 Dec 2023 11:58:10 +0100 Subject: acprep: Add dependencies for Debian trixie --- acprep | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/acprep b/acprep index 0322d886..786bc63a 100755 --- a/acprep +++ b/acprep @@ -709,6 +709,33 @@ class PrepareBuild(CommandLineApp): self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) + if exists('/etc/debian_version'): + release = open('/etc/debian_version').readline() + if release.startswith('trixie'): + self.log.info(f'Looks like you are using APT on Debian {release}') + packages = [ + 'sudo', 'apt', 'install', '-y', '--no-install-recommends', + 'clang', + 'cmake', + 'ninja', + 'libboost-dev', + 'libmpfr-dev', + 'libgmp-dev', + 'libicu-dev', + 'libedit-dev', + 'libutfcpp-dev', + 'gettext', + 'texinfo', + 'doxygen', + 'graphviz', + 'lcov', + 'sloccount', + ] + self.log.info('Executing: ' + ' '.join(packages)) + self.execute(*packages) + else: + self.log.info(f"I do not recognize your version '{release}' of Debian!") + if exists('/etc/redhat-release'): release = open('/etc/redhat-release').readline() if release.startswith('CentOS'): -- cgit v1.2.3 From 11b8e048d3ae5fe922bc9007425fd6b709bde5b5 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 6 Dec 2023 12:08:01 +0100 Subject: acprep: Simplify detecting system via os.uname --- acprep | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/acprep b/acprep index 786bc63a..6ec372f8 100755 --- a/acprep +++ b/acprep @@ -358,25 +358,6 @@ class PrepareBuild(CommandLineApp): self.log.error("Execution failed: " + e) sys.exit(1) - def get_stdout(self, *args): - try: - self.log.debug('Executing command: ' + ' '.join(args)) - - proc = Popen(args, shell=False, stdout=PIPE) - stdout = proc.stdout.read() - retcode = proc.wait() - if retcode < 0: - self.log.error("Child was terminated by signal", - -retcode) - sys.exit(1) - elif retcode != 0: - self.log.error("Execution failed: " + ' '.join(args)) - sys.exit(1) - return stdout[:-1] - except OSError as e: - self.log.error("Execution failed:" + e) - sys.exit(1) - def isnewer(self, file1, file2): "Check if file1 is newer than file2." if not exists(file2): @@ -502,7 +483,7 @@ class PrepareBuild(CommandLineApp): self.log.info("Installing Ledger's build dependencies ...") - system = self.get_stdout('uname', '-s').decode(locale.getpreferredencoding()) + system = os.uname().sysname if system == 'Darwin': if exists('/opt/local/bin/port'): @@ -823,7 +804,7 @@ class PrepareBuild(CommandLineApp): self.configure_args.append(self.source_dir) def setup_for_system(self): - system = self.get_stdout('uname', '-s').decode(locale.getpreferredencoding()) + system = os.uname().sysname self.log.info('System type is => ' + system) if self.options.enable_doxygen: -- cgit v1.2.3 From d6d46e41f570dacb09a9f4ae8a208fb3afb34d37 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 6 Dec 2023 12:08:36 +0100 Subject: acprep: Minor clean-up --- acprep | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/acprep b/acprep index 6ec372f8..f33a0d29 100755 --- a/acprep +++ b/acprep @@ -100,7 +100,6 @@ class CommandLineApp(object): force_exit = True # If true, always ends run() with sys.exit() log_handler = None - boost_major = "1_52" def __init__(self): "Initialize CommandLineApp." @@ -519,8 +518,7 @@ class PrepareBuild(CommandLineApp): elif system == 'Linux': if exists('/etc/issue'): - issue = open('/etc/issue') - issue_name = issue.readline() + issue_name = open('/etc/issue').readline() if issue_name.startswith('Ubuntu'): info = dict([line.strip().split('=', 1) for line in open('/etc/lsb-release')]) -- cgit v1.2.3 From e39d148af75225b0d46cc63f15bad853a7a5ce6a Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 6 Dec 2023 12:09:30 +0100 Subject: acprep: Replace hardcoded paths with shutil.which --- acprep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acprep b/acprep index f33a0d29..1ebc0ef2 100755 --- a/acprep +++ b/acprep @@ -485,7 +485,7 @@ class PrepareBuild(CommandLineApp): system = os.uname().sysname if system == 'Darwin': - if exists('/opt/local/bin/port'): + if shutil.which('port'): self.log.info('Looks like you are using MacPorts on macOS') packages = [ 'sudo', 'port', 'install', '-f', @@ -502,7 +502,7 @@ class PrepareBuild(CommandLineApp): ] + BoostInfo().dependencies('darwin-macports') self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) - elif exists('/usr/local/bin/brew') or exists('/opt/local/bin/brew'): + elif shutil.which('brew'): self.log.info('Looks like you are using Homebrew on macOS') packages = [ 'brew', 'install', @@ -511,7 +511,7 @@ class PrepareBuild(CommandLineApp): ] + BoostInfo().dependencies('darwin-homebrew') self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) - elif exists('/sw/bin/fink'): + elif shutil.which('fink'): self.log.info('Looks like you are using Fink on macOS') self.log.error("I don't know the package names for Fink yet!") sys.exit(1) -- cgit v1.2.3 From 2c942c78c61e2ffb84382d2efe41180710939836 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 6 Dec 2023 12:10:31 +0100 Subject: acprep: Add support for nix develop on macOS --- acprep | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/acprep b/acprep index 1ebc0ef2..13032e39 100755 --- a/acprep +++ b/acprep @@ -515,6 +515,13 @@ class PrepareBuild(CommandLineApp): self.log.info('Looks like you are using Fink on macOS') self.log.error("I don't know the package names for Fink yet!") sys.exit(1) + elif shutil.which('nix'): + self.log.info('Looks like you are using Nixpkgs on macOS') + packages = [ + 'nix', 'develop', + ] + self.log.info('Executing: ' + ' '.join(packages)) + self.execute(*packages) elif system == 'Linux': if exists('/etc/issue'): -- cgit v1.2.3