Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG1371c18e467d: setup: remove printf trampoline
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
indygreg |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | setup.py (9 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
960654ed36ec | d2f57d74cdcc | Augie Fackler | Mar 2 2022, 10:07 AM |
'!=3.6.0', | '!=3.6.0', | ||||
'!=3.6.1', | '!=3.6.1', | ||||
] | ] | ||||
) | ) | ||||
import sys, platform | import sys, platform | ||||
import sysconfig | import sysconfig | ||||
printf = eval('print') | |||||
libdir_escape = 'unicode_escape' | libdir_escape = 'unicode_escape' | ||||
def sysstr(s): | def sysstr(s): | ||||
return s.decode('latin-1') | return s.decode('latin-1') | ||||
import ssl | import ssl | ||||
has_tlsv1_2 = getattr(ssl, 'PROTOCOL_TLSv1_2', _notset) is not _notset | has_tlsv1_2 = getattr(ssl, 'PROTOCOL_TLSv1_2', _notset) is not _notset | ||||
if not (has_tlsv1_1 or has_tlsv1_2): | if not (has_tlsv1_1 or has_tlsv1_2): | ||||
error = """ | error = """ | ||||
The `ssl` module does not advertise support for TLS 1.1 or TLS 1.2. | The `ssl` module does not advertise support for TLS 1.1 or TLS 1.2. | ||||
Please make sure that your Python installation was compiled against an OpenSSL | Please make sure that your Python installation was compiled against an OpenSSL | ||||
version enabling these features (likely this requires the OpenSSL version to | version enabling these features (likely this requires the OpenSSL version to | ||||
be at least 1.0.1). | be at least 1.0.1). | ||||
""" | """ | ||||
printf(error, file=sys.stderr) | print(error, file=sys.stderr) | ||||
sys.exit(1) | sys.exit(1) | ||||
if sys.version_info[0] >= 3: | if sys.version_info[0] >= 3: | ||||
DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX'] | DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX'] | ||||
else: | else: | ||||
# deprecated in Python 3 | # deprecated in Python 3 | ||||
DYLIB_SUFFIX = sysconfig.get_config_vars()['SO'] | DYLIB_SUFFIX = sysconfig.get_config_vars()['SO'] | ||||
self.cmd = cmd | self.cmd = cmd | ||||
self.env = env | self.env = env | ||||
def run(self, args): | def run(self, args): | ||||
cmd = self.cmd + args | cmd = self.cmd + args | ||||
returncode, out, err = runcmd(cmd, self.env) | returncode, out, err = runcmd(cmd, self.env) | ||||
err = filterhgerr(err) | err = filterhgerr(err) | ||||
if err or returncode != 0: | if err or returncode != 0: | ||||
printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) | print("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) | ||||
printf(err, file=sys.stderr) | print(err, file=sys.stderr) | ||||
return b'' | return b'' | ||||
return out | return out | ||||
def filterhgerr(err): | def filterhgerr(err): | ||||
# If root is executing setup.py, but the repository is owned by | # If root is executing setup.py, but the repository is owned by | ||||
# another user (as in "sudo python setup.py install") we will get | # another user (as in "sudo python setup.py install") we will get | ||||
# trust warnings since the .hg/hgrc file is untrusted. That is | # trust warnings since the .hg/hgrc file is untrusted. That is | ||||
ret = Distribution.parse_command_line(self) | ret = Distribution.parse_command_line(self) | ||||
if not (self.rust or self.no_rust): | if not (self.rust or self.no_rust): | ||||
hgrustext = os.environ.get('HGWITHRUSTEXT') | hgrustext = os.environ.get('HGWITHRUSTEXT') | ||||
# TODO record it for proper rebuild upon changes | # TODO record it for proper rebuild upon changes | ||||
# (see mercurial/__modulepolicy__.py) | # (see mercurial/__modulepolicy__.py) | ||||
if hgrustext != 'cpython' and hgrustext is not None: | if hgrustext != 'cpython' and hgrustext is not None: | ||||
if hgrustext: | if hgrustext: | ||||
msg = 'unknown HGWITHRUSTEXT value: %s' % hgrustext | msg = 'unknown HGWITHRUSTEXT value: %s' % hgrustext | ||||
printf(msg, file=sys.stderr) | print(msg, file=sys.stderr) | ||||
hgrustext = None | hgrustext = None | ||||
self.rust = hgrustext is not None | self.rust = hgrustext is not None | ||||
self.no_rust = not self.rust | self.no_rust = not self.rust | ||||
return ret | return ret | ||||
def has_ext_modules(self): | def has_ext_modules(self): | ||||
# self.ext_modules is emptied in hgbuildpy.finalize_options which is | # self.ext_modules is emptied in hgbuildpy.finalize_options which is | ||||
# too late for some cases | # too late for some cases |