Commit b9efd0b5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8708ccde
......@@ -55,7 +55,7 @@ func NeedPy(t testing.TB, modules ...string) {
// verify if python is present
havePy, know := pyHave[".python"]
if !know {
cmd := exec.Command("python2", "-c", "0")
cmd := exec.Command("python", "-c", "0")
err := cmd.Run()
havePy = (err == nil)
pyHave[".python"] = havePy
......@@ -69,7 +69,7 @@ func NeedPy(t testing.TB, modules ...string) {
for _, pymod := range modules {
have, know := pyHave[pymod]
if !know {
cmd := exec.Command("python2", "-c", "import "+pymod)
cmd := exec.Command("python", "-c", "import "+pymod)
err := cmd.Run()
have = (err == nil)
pyHave[pymod] = have
......@@ -112,7 +112,7 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err
zin.WriteString("\n")
// run py `zodb commit`
cmd:= exec.Command("python2", "-m", "zodbtools.zodb", "commit", zurl, at.String())
cmd:= exec.Command("python", "-m", "zodbtools.zodb", "commit", zurl, at.String())
cmd.Stdin = zin
cmd.Stderr = os.Stderr
out, err := cmd.Output()
......
......@@ -69,7 +69,7 @@ func encodePyData(pyclass pickle.Class, pystate interface{}) PyData {
p := pickle.NewEncoderWithConfig(buf, &pickle.EncoderConfig{
// allow pristine python2 to decode the pickle.
// TODO 2 -> 3 since ZODB5 switched to it and uses zodbpickle.
Protocol: 2,
Protocol: 2, // XXX -> 3?
PersistentRef: persistentRef,
})
......
......@@ -68,7 +68,8 @@ type DataHeader struct {
}
const (
Magic = "FS21" // every FileStorage file starts with this
Magic21 = "FS21" // FileStorage file produced by Python2 starts with this
Magic30 = "FS30" // ----//---- by Python3 XXX +test
// on-disk sizes
FileHeaderSize = 4
......@@ -154,8 +155,12 @@ func (fh *FileHeader) Load(r io.ReaderAt) error {
if err != nil {
return fmt.Errorf("%sread magic: %s", ioprefix(r), err)
}
if string(fh.Magic[:]) != Magic {
switch string(fh.Magic[:]) {
default:
return fmt.Errorf("%sinvalid fs1 magic %q", ioprefix(r), fh.Magic)
case Magic21, Magic30:
// ok XXX do we need to distinguish them somehow?
}
return nil
......
......@@ -19,6 +19,8 @@
package fs1tools
// XXX + py3
//go:generate sh -c "python2 -m ZODB.scripts.fstail -n 1000000 ../testdata/1.fs >testdata/1.fstail.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage import fsdump; fsdump.main()' ../testdata/1.fs >testdata/1.fsdump.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage.fsdump import Dumper; import sys; d = Dumper(sys.argv[1]); d.dump()' ../testdata/1.fs >testdata/1.fsdumpv.ok"
......
......@@ -19,6 +19,8 @@
package zodbtools
// XXX +py3 ?
//go:generate sh -c "python2 -m zodbtools.zodb dump ../../zodb/storage/fs1/testdata/1.fs >testdata/1.zdump.pyok"
//go:generate sh -c "python2 -m zodbtools.zodb dump ../../zodb/storage/fs1/testdata/empty.fs >testdata/empty.zdump.pyok"
......
......@@ -118,7 +118,7 @@ func (δtail *ΔTail) Tail() Tid {
//
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
func (δtail *ΔTail) SliceByRev(low, high Tid) /*readonly*/ []ΔRevEntry {
tail := δtail.Tail()
tail := δtail.tail
head := δtail.head
if !(tail <= low && low <= high && high <= head) {
panic(fmt.Sprintf("δtail.Slice: invalid query: (%s, %s]; (tail, head] = (%s, %s]", low, high, tail, head))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment