Show More
@@ -136,14 +136,6 b' else:' | |||||
136 |
|
136 | |||
137 | ispypy = "PyPy" in sys.version |
|
137 | ispypy = "PyPy" in sys.version | |
138 |
|
138 | |||
139 | hgrustext = os.environ.get('HGWITHRUSTEXT') |
|
|||
140 | # TODO record it for proper rebuild upon changes |
|
|||
141 | # (see mercurial/__modulepolicy__.py) |
|
|||
142 | if hgrustext != 'cpython' and hgrustext is not None: |
|
|||
143 | if hgrustext: |
|
|||
144 | printf('unkown HGWITHRUSTEXT value: %s' % hgrustext, file=sys.stderr) |
|
|||
145 | hgrustext = None |
|
|||
146 |
|
||||
147 | import ctypes |
|
139 | import ctypes | |
148 | import errno |
|
140 | import errno | |
149 | import stat, subprocess, time |
|
141 | import stat, subprocess, time | |
@@ -478,14 +470,45 b' class hgbuildmo(build):' | |||||
478 |
|
470 | |||
479 | class hgdist(Distribution): |
|
471 | class hgdist(Distribution): | |
480 | pure = False |
|
472 | pure = False | |
481 | rust = hgrustext is not None |
|
473 | rust = False | |
|
474 | no_rust = False | |||
482 | cffi = ispypy |
|
475 | cffi = ispypy | |
483 |
|
476 | |||
484 | global_options = Distribution.global_options + [ |
|
477 | global_options = Distribution.global_options + [ | |
485 | ('pure', None, "use pure (slow) Python code instead of C extensions"), |
|
478 | ('pure', None, "use pure (slow) Python code instead of C extensions"), | |
486 | ('rust', None, "use Rust extensions additionally to C extensions"), |
|
479 | ('rust', None, "use Rust extensions additionally to C extensions"), | |
|
480 | ( | |||
|
481 | 'no-rust', | |||
|
482 | None, | |||
|
483 | "do not use Rust extensions additionally to C extensions", | |||
|
484 | ), | |||
487 | ] |
|
485 | ] | |
488 |
|
486 | |||
|
487 | negative_opt = Distribution.negative_opt.copy() | |||
|
488 | boolean_options = ['pure', 'rust', 'no-rust'] | |||
|
489 | negative_opt['no-rust'] = 'rust' | |||
|
490 | ||||
|
491 | def _set_command_options(self, command_obj, option_dict=None): | |||
|
492 | command_obj.boolean_options += self.boolean_options | |||
|
493 | return Distribution._set_command_options( | |||
|
494 | self, command_obj, option_dict=option_dict | |||
|
495 | ) | |||
|
496 | ||||
|
497 | def parse_command_line(self): | |||
|
498 | ret = Distribution.parse_command_line(self) | |||
|
499 | if not (self.rust or self.no_rust): | |||
|
500 | hgrustext = os.environ.get('HGWITHRUSTEXT') | |||
|
501 | # TODO record it for proper rebuild upon changes | |||
|
502 | # (see mercurial/__modulepolicy__.py) | |||
|
503 | if hgrustext != 'cpython' and hgrustext is not None: | |||
|
504 | if hgrustext: | |||
|
505 | msg = 'unkown HGWITHRUSTEXT value: %s' % hgrustext | |||
|
506 | printf(msg, file=sys.stderr) | |||
|
507 | hgrustext = None | |||
|
508 | self.rust = hgrustext is not None | |||
|
509 | self.no_rust = not self.rust | |||
|
510 | return ret | |||
|
511 | ||||
489 | def has_ext_modules(self): |
|
512 | def has_ext_modules(self): | |
490 | # self.ext_modules is emptied in hgbuildpy.finalize_options which is |
|
513 | # self.ext_modules is emptied in hgbuildpy.finalize_options which is | |
491 | # too late for some cases |
|
514 | # too late for some cases |
General Comments 0
You need to be logged in to leave comments.
Login now