setup.py
branchstable
changeset 48796 c00d3ce4e94b
parent 48773 6cfa30681a1d
child 48823 9af9e2d54857
equal deleted inserted replaced
48776:b84ff512b645 48796:c00d3ce4e94b
   207     DistutilsExecError,
   207     DistutilsExecError,
   208 )
   208 )
   209 from distutils.sysconfig import get_python_inc, get_config_var
   209 from distutils.sysconfig import get_python_inc, get_config_var
   210 from distutils.version import StrictVersion
   210 from distutils.version import StrictVersion
   211 
   211 
   212 # Explain to distutils.StrictVersion how our release candidates are versionned
   212 # Explain to distutils.StrictVersion how our release candidates are versioned
   213 StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$')
   213 StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$')
   214 
   214 
   215 
   215 
   216 def write_if_changed(path, content):
   216 def write_if_changed(path, content):
   217     """Write content to a file iff the content hasn't changed."""
   217     """Write content to a file iff the content hasn't changed."""
   533             hgrustext = os.environ.get('HGWITHRUSTEXT')
   533             hgrustext = os.environ.get('HGWITHRUSTEXT')
   534             # TODO record it for proper rebuild upon changes
   534             # TODO record it for proper rebuild upon changes
   535             # (see mercurial/__modulepolicy__.py)
   535             # (see mercurial/__modulepolicy__.py)
   536             if hgrustext != 'cpython' and hgrustext is not None:
   536             if hgrustext != 'cpython' and hgrustext is not None:
   537                 if hgrustext:
   537                 if hgrustext:
   538                     msg = 'unkown HGWITHRUSTEXT value: %s' % hgrustext
   538                     msg = 'unknown HGWITHRUSTEXT value: %s' % hgrustext
   539                     printf(msg, file=sys.stderr)
   539                     printf(msg, file=sys.stderr)
   540                 hgrustext = None
   540                 hgrustext = None
   541             self.rust = hgrustext is not None
   541             self.rust = hgrustext is not None
   542             self.no_rust = not self.rust
   542             self.no_rust = not self.rust
   543         return ret
   543         return ret
   595         if not self.zstd:
   595         if not self.zstd:
   596             self.extensions = [
   596             self.extensions = [
   597                 e for e in self.extensions if e.name != 'mercurial.zstd'
   597                 e for e in self.extensions if e.name != 'mercurial.zstd'
   598             ]
   598             ]
   599 
   599 
   600         # Build Rust standalon extensions if it'll be used
   600         # Build Rust standalone extensions if it'll be used
   601         # and its build is not explictely disabled (for external build
   601         # and its build is not explicitly disabled (for external build
   602         # as Linux distributions would do)
   602         # as Linux distributions would do)
   603         if self.distribution.rust and self.rust:
   603         if self.distribution.rust and self.rust:
   604             if not sys.platform.startswith('linux'):
   604             if not sys.platform.startswith('linux'):
   605                 self.warn(
   605                 self.warn(
   606                     "rust extensions have only been tested on Linux "
   606                     "rust extensions have only been tested on Linux "
  1500         except OSError as exc:
  1500         except OSError as exc:
  1501             if exc.errno == errno.ENOENT:
  1501             if exc.errno == errno.ENOENT:
  1502                 raise RustCompilationError("Cargo not found")
  1502                 raise RustCompilationError("Cargo not found")
  1503             elif exc.errno == errno.EACCES:
  1503             elif exc.errno == errno.EACCES:
  1504                 raise RustCompilationError(
  1504                 raise RustCompilationError(
  1505                     "Cargo found, but permisssion to execute it is denied"
  1505                     "Cargo found, but permission to execute it is denied"
  1506                 )
  1506                 )
  1507             else:
  1507             else:
  1508                 raise
  1508                 raise
  1509         except subprocess.CalledProcessError:
  1509         except subprocess.CalledProcessError:
  1510             raise RustCompilationError(
  1510             raise RustCompilationError(