bup
bup-*
randomgen
-randomgen.exe
*.o
*.so
+*.exe
*.dll
*~
*.pyc
gcc -c -o $@ $^ $(CPPFLAGS) $(CFLAGS)
clean:
- rm -f *.o *.so *.dll *~ .*~ *.pyc */*.pyc */*~ \
- bup bup-* randomgen$(EXT) \
+ rm -f *.o *.so *.dll *.exe *~ .*~ *.pyc */*.pyc */*~ \
+ bup bup-* randomgen \
out[12] out2[tc] tags[12] tags2[tc]
rm -rf *.tmp
#log('argv is: %r\n' % argv)
(self.host, self.dir) = (host, dir)
self.cachedir = git.repo('index-cache/%s'
- % re.sub(r'[^@:\w]', '_',
- "%s-%s" % (host, dir)))
+ % re.sub(r'[^@\w]', '_',
+ "%s:%s" % (host, dir)))
try:
self.p = p = Popen(argv, stdin=PIPE, stdout=PIPE, preexec_fn=fixenv)
except OSError, e:
import options, git, index
from helpers import *
+
+try:
+ O_LARGEFILE = os.O_LARGEFILE
+except AttributeError:
+ O_LARGEFILE = 0
+
+
class OsFile:
def __init__(self, path):
self.fd = None
- try:
- self.fd = os.open(path, os.O_RDONLY|os.O_LARGEFILE|os.O_NOFOLLOW)
- except AttributeError:
- self.fd = os.open(path, os.O_RDONLY|os.O_NOFOLLOW)
- #self.st = os.fstat(self.fd)
+ self.fd = os.open(path, os.O_RDONLY|O_LARGEFILE|os.O_NOFOLLOW)
def __del__(self):
if self.fd:
-import sys, os, pwd, subprocess, errno
+import sys, os, pwd, subprocess, errno, socket
def log(s):
def hostname():
global _hostname
if not _hostname:
- try:
- if sys.platform == 'cygwin':
- hostcmd = ['hostname']
- else:
- hostcmd = ['hostname', '-f']
- _hostname = readpipe(hostcmd).strip()
- except OSError:
- pass
- return _hostname or 'localhost'
+ _hostname = socket.getfqdn()
+ return _hostname
class Conn:
ofs = eon + 1 + ENTLEN
def save(self):
- if self.writable:
+ if self.writable and self.m:
self.m.flush()
def close(self):
self.save()
- if self.writable:
- self.m.close()
+ if self.writable and self.m:
+ self.m = None
self.writable = False
def filter(self, prefixes):
self.f = None
if f:
f.close()
- try:
- os.rename(self.tmpname, self.filename)
- except OSError:
- if os.path.exists(self.filename):
- os.unlink(self.filename)
- os.rename(self.tmpname, self.filename)
+ os.rename(self.tmpname, self.filename)
def _write(self, data):
self.f.write(data)