mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-23 18:58:50 -06:00
Tools cleanup
Add a python test, clean up some error messages, and trim env vars that don't need to be passed to build/staging scripts.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, os.path, subprocess, sys
|
||||
import os, os.path, subprocess
|
||||
|
||||
import noms.symlink as symlink
|
||||
|
||||
|
||||
@@ -29,8 +29,10 @@ def Main(projectName, stagingFunction):
|
||||
args = parser.parse_args()
|
||||
projectStagingDir = os.path.join(args.stagingDir, projectName)
|
||||
|
||||
# check if project dir is in staging dir
|
||||
normalized = os.path.realpath(projectStagingDir)
|
||||
if not _isSubDir(projectStagingDir, args.stagingDir):
|
||||
raise Exception(projectStagingDir + ' must be a subdir of ' + args.stagingDir)
|
||||
|
||||
os.makedirs(normalized)
|
||||
stagingFunction(normalized)
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@ class TestStaging(unittest.TestCase):
|
||||
self.assertFalse(staging._isSubDir(self.nested, otherNested))
|
||||
|
||||
|
||||
def test_DotDotNotReallyNested(self):
|
||||
notReallyNested = os.path.join(self.tempdir, 'foo', os.pardir, 'bar')
|
||||
self.assertFalse(staging._isSubDir(self.nested, notReallyNested))
|
||||
|
||||
|
||||
def test_LinkNotReallyNested(self):
|
||||
otherNested = tempfile.mkdtemp(dir=self.tempdir)
|
||||
linkName = os.path.join(self.nested, 'link')
|
||||
|
||||
@@ -43,11 +43,8 @@ func main() {
|
||||
}
|
||||
pythonPath := filepath.Join(goPath, nomsCheckoutPath, "tools")
|
||||
env := runner.Env{
|
||||
"GOPATH": goPath,
|
||||
"PYTHONPATH": pythonPath,
|
||||
"NOMS_SERVER": nomsServer,
|
||||
"NOMS_CHECKOUT_PATH": filepath.Join(workspace, nomsCheckoutPath),
|
||||
"ATTIC_CHECKOUT_PATH": filepath.Join(workspace, atticCheckoutPath),
|
||||
"PYTHONPATH": pythonPath,
|
||||
"NOMS_SERVER": nomsServer,
|
||||
}
|
||||
|
||||
if !runner.Serial(os.Stdout, os.Stderr, env, ".", buildScript) {
|
||||
|
||||
@@ -52,7 +52,7 @@ func Serial(stdout, stderr io.Writer, env Env, dir, filename string, args ...str
|
||||
runErr := runEnvDir(stdout, stderr, env, filepath.Dir(path), "python", scriptAndArgs...)
|
||||
if runErr != nil {
|
||||
success = false
|
||||
fmt.Fprintf(stderr, "Running %s failed with %v", path, runErr)
|
||||
fmt.Fprintf(stderr, "Running %s failed with %v\n", path, runErr)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user