mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
checks: fixup test-check-module-imports for rust changes
Summary: Fix up test-check-module-imports, mostly by using absolute imports where possible. Also, some lfs errors have been removed, so remove their tests failures too. Test Plan: Run test-check-module-imports test. Reviewers: durham, #mercurial Reviewed By: durham Differential Revision: https://phabricator.intern.facebook.com/D6679241 Tasks: T24908724 Signature: 6679241:1515457419:2f8683206c8d43af99254c9f75f08af374673c2f
This commit is contained in:
parent
1a84c9d5db
commit
c9db9d4c02
@ -3,11 +3,10 @@
|
||||
# Copyright 2017 Facebook, Inc.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from distutils.core import Command
|
||||
from distutils.dist import Distribution
|
||||
from distutils.errors import CompileError
|
||||
from distutils import log
|
||||
from distutils.command.build import build
|
||||
import distutils
|
||||
import distutils.command.build
|
||||
import distutils.core
|
||||
import distutils.errors
|
||||
import distutils.util
|
||||
import os
|
||||
import shutil
|
||||
@ -31,7 +30,7 @@ class RustExtension(object):
|
||||
self.package = package
|
||||
self.manifest = manifest or 'Cargo.toml'
|
||||
|
||||
class BuildRustExt(Command):
|
||||
class BuildRustExt(distutils.core.Command):
|
||||
|
||||
description = "build Rust extensions (compile/link to build directory)"
|
||||
|
||||
@ -100,7 +99,7 @@ class BuildRustExt(Command):
|
||||
return os.path.join(package_dir, name)
|
||||
|
||||
def build_ext(self, ext):
|
||||
log.info("building '%s' extension", ext.name)
|
||||
distutils.log.info("building '%s' extension", ext.name)
|
||||
|
||||
cmd = ['cargo', 'build', '--manifest-path', ext.manifest]
|
||||
if not self.debug:
|
||||
@ -111,7 +110,7 @@ class BuildRustExt(Command):
|
||||
|
||||
rc = subprocess.call(cmd, env=env)
|
||||
if rc:
|
||||
raise CompileError(
|
||||
raise distutils.errors.CompileError(
|
||||
"compilation of Rust extension '%s' failed" % ext.name)
|
||||
|
||||
src = os.path.join(self.get_temp_path(ext), self.get_temp_output(ext))
|
||||
@ -119,6 +118,6 @@ class BuildRustExt(Command):
|
||||
shutil.copyfile(src, dest)
|
||||
shutil.copymode(src, dest)
|
||||
|
||||
Distribution.rust_ext_modules = ()
|
||||
build.sub_commands.append(
|
||||
distutils.dist.Distribution.rust_ext_modules = ()
|
||||
distutils.command.build.build.sub_commands.append(
|
||||
('build_rust_ext', lambda self: bool(self.distribution.rust_ext_modules)))
|
||||
|
@ -54,7 +54,7 @@ import random
|
||||
import struct
|
||||
import string
|
||||
|
||||
from hgext.extlib.treedirstate import treedirstatemap as rusttreedirstatemap
|
||||
import hgext.extlib.treedirstate
|
||||
|
||||
dirstateheader = b'########################treedirstate####'
|
||||
treedirstateversion = 1
|
||||
@ -158,7 +158,7 @@ class treedirstatemap(object):
|
||||
self.copymap = {}
|
||||
|
||||
self._filename = 'dirstate'
|
||||
self._rmap = rusttreedirstatemap(ui, opener)
|
||||
self._rmap = hgext.extlib.treedirstate.treedirstatemap(ui, opener)
|
||||
self._treeid = None
|
||||
self._parents = None
|
||||
self._dirtyparents = False
|
||||
|
@ -131,9 +131,6 @@ outputs, which should be fixed later.
|
||||
fb-hgext/hgext3rd/treedirstate.py:54: stdlib import "struct" follows local import: mercurial.i18n
|
||||
fb-hgext/hgext3rd/treedirstate.py:55: imports not lexically sorted: string < struct
|
||||
fb-hgext/hgext3rd/treedirstate.py:55: stdlib import "string" follows local import: mercurial.i18n
|
||||
fb-hgext/hgext3rd/treedirstate.py:57: relative import of stdlib module
|
||||
fb-hgext/hgext3rd/treedirstate.py:57: direct symbol import treedirstatemap from hgext3rd.rust.treedirstate
|
||||
fb-hgext/hgext3rd/treedirstate.py:57: symbol import follows non-symbol import: hgext3rd.rust.treedirstate
|
||||
fb-hgext/hgext3rd/tweakdefaults.py:70: imports from mercurial not lexically sorted: encoding < error
|
||||
fb-hgext/hgext3rd/tweakdefaults.py:89: stdlib import "inspect" follows local import: hgext
|
||||
fb-hgext/hgext3rd/tweakdefaults.py:90: stdlib import "json" follows local import: hgext
|
||||
|
Loading…
Reference in New Issue
Block a user