Patchwork [3,of,3] rust: switched to 'cargo rustc' in setup.py

login
register
mail settings
Submitter Georges Racinet
Date June 14, 2019, 10:42 a.m.
Message ID <1bd9227bf68db22ce48a.1560508941@ishtar>
Download mbox | patch
Permalink /patch/40508/
State Accepted
Headers show

Comments

Georges Racinet - June 14, 2019, 10:42 a.m.
# HG changeset patch
# User Georges Racinet <georges.racinet@octobus.net>
# Date 1558045063 -7200
#      Fri May 17 00:17:43 2019 +0200
# Node ID 1bd9227bf68db22ce48ab381c4d26d4c71edca42
# Parent  2cbfd089a1ce0ec46f9e124e0574e74491fa4788
# EXP-Topic rust-build-platforms
rust: switched to 'cargo rustc' in setup.py

This is more flexible in the passing of additional flags, also
what setuptools_rust does, giving less uncertainty about non-Linux
platforms.
Augie Fackler - June 14, 2019, 2:30 p.m.
Queued these - including verifying the build worked on my Mac. Thanks!

> On Jun 14, 2019, at 06:42, Georges Racinet <georges.racinet@octobus.net> wrote:
> 
> # HG changeset patch
> # User Georges Racinet <georges.racinet@octobus.net>
> # Date 1558045063 -7200
> #      Fri May 17 00:17:43 2019 +0200
> # Node ID 1bd9227bf68db22ce48ab381c4d26d4c71edca42
> # Parent  2cbfd089a1ce0ec46f9e124e0574e74491fa4788
> # EXP-Topic rust-build-platforms
> rust: switched to 'cargo rustc' in setup.py
> 
> This is more flexible in the passing of additional flags, also
> what setuptools_rust does, giving less uncertainty about non-Linux
> platforms.
> 
> diff -r 2cbfd089a1ce -r 1bd9227bf68d setup.py
> --- a/setup.py	Fri Jun 14 11:18:06 2019 +0100
> +++ b/setup.py	Fri May 17 00:17:43 2019 +0200
> @@ -1195,13 +1195,14 @@
>             import pwd
>             env['HOME'] = pwd.getpwuid(os.getuid()).pw_dir
> 
> -        cargocmd = ['cargo', 'build', '-vv', '--release']
> +        cargocmd = ['cargo', 'rustc', '-vv', '--release']
>         if sys.version_info[0] == 3 and self.py3_features is not None:
>             cargocmd.extend(('--features', self.py3_features,
>                              '--no-default-features'))
> +        cargocmd.append('--')
>         if sys.platform == 'darwin':
> -            env['RUSTFLAGS'] = ("-C link-arg=-undefined "
> -                                "-C link-arg=dynamic_lookup")
> +            cargocmd.extend(("-C", "link-arg=-undefined",
> +                             "-C", "link-arg=dynamic_lookup"))
>         try:
>             subprocess.check_call(cargocmd, env=env, cwd=self.rustsrcdir)
>         except OSError as exc:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff -r 2cbfd089a1ce -r 1bd9227bf68d setup.py
--- a/setup.py	Fri Jun 14 11:18:06 2019 +0100
+++ b/setup.py	Fri May 17 00:17:43 2019 +0200
@@ -1195,13 +1195,14 @@ 
             import pwd
             env['HOME'] = pwd.getpwuid(os.getuid()).pw_dir
 
-        cargocmd = ['cargo', 'build', '-vv', '--release']
+        cargocmd = ['cargo', 'rustc', '-vv', '--release']
         if sys.version_info[0] == 3 and self.py3_features is not None:
             cargocmd.extend(('--features', self.py3_features,
                              '--no-default-features'))
+        cargocmd.append('--')
         if sys.platform == 'darwin':
-            env['RUSTFLAGS'] = ("-C link-arg=-undefined "
-                                "-C link-arg=dynamic_lookup")
+            cargocmd.extend(("-C", "link-arg=-undefined",
+                             "-C", "link-arg=dynamic_lookup"))
         try:
             subprocess.check_call(cargocmd, env=env, cwd=self.rustsrcdir)
         except OSError as exc: