Ejemplo n.º 1
0
	def __init__(self):
		import_pyuv()
		self.watches = {}
		self.lock = RLock()
		self.loop = start_uv_thread()
		self.fenc = get_preferred_file_name_encoding()
		if pyuv_version_info >= (1, 0):
			self._start_watch = self._start_watch_1_x
		else:
			self._start_watch = self._start_watch_0_x
Ejemplo n.º 2
0
def git_directory(directory):
    path = join(directory, ".git")
    if os.path.isfile(path):
        with open(path, "rb") as f:
            raw = f.read()
            if not raw.startswith(b"gitdir: "):
                raise IOError("invalid gitfile format")
            raw = raw[8:]
            if raw[-1:] == b"\n":
                raw = raw[:-1]
            if not isinstance(path, bytes):
                raw = raw.decode(get_preferred_file_name_encoding())
            if not raw:
                raise IOError("no path in gitfile")
            return os.path.abspath(os.path.join(directory, raw))
    else:
        return path
Ejemplo n.º 3
0
def git_directory(directory):
    path = join(directory, '.git')
    if os.path.isfile(path):
        with open(path, 'rb') as f:
            raw = f.read()
            if not raw.startswith(b'gitdir: '):
                raise IOError('invalid gitfile format')
            raw = raw[8:]
            if raw[-1:] == b'\n':
                raw = raw[:-1]
            if not isinstance(path, bytes):
                raw = raw.decode(get_preferred_file_name_encoding())
            if not raw:
                raise IOError('no path in gitfile')
            return os.path.abspath(os.path.join(directory, raw))
    else:
        return path
Ejemplo n.º 4
0
def git_directory(directory):
	path = join(directory, '.git')
	if os.path.isfile(path):
		with open(path, 'rb') as f:
			raw = f.read()
			if not raw.startswith(b'gitdir: '):
				raise IOError('invalid gitfile format')
			raw = raw[8:]
			if raw[-1:] == b'\n':
				raw = raw[:-1]
			if not isinstance(path, bytes):
				raw = raw.decode(get_preferred_file_name_encoding())
			if not raw:
				raise IOError('no path in gitfile')
			return os.path.abspath(os.path.join(directory, raw))
	else:
		return path
Ejemplo n.º 5
0
	def __init__(self, cloexec=True, nonblock=True):
		self._init1, self._add_watch, self._rm_watch, self._read = load_inotify()
		flags = 0
		if cloexec:
			flags |= self.CLOEXEC
		if nonblock:
			flags |= self.NONBLOCK
		self._inotify_fd = self._init1(flags)
		if self._inotify_fd == -1:
			raise INotifyError(os.strerror(ctypes.get_errno()))

		self._buf = ctypes.create_string_buffer(5000)
		self.fenc = get_preferred_file_name_encoding()
		self.hdr = struct.Struct(b'iIII')
		# We keep a reference to os to prevent it from being deleted
		# during interpreter shutdown, which would lead to errors in the
		# __del__ method
		self.os = os
Ejemplo n.º 6
0
    def __init__(self, cloexec=True, nonblock=True):
        self._init1, self._add_watch, self._rm_watch, self._read = load_inotify()
        flags = 0
        if cloexec:
            flags |= self.CLOEXEC
        if nonblock:
            flags |= self.NONBLOCK
        self._inotify_fd = self._init1(flags)
        if self._inotify_fd == -1:
            raise INotifyError(os.strerror(ctypes.get_errno()))

        self._buf = ctypes.create_string_buffer(5000)
        self.fenc = get_preferred_file_name_encoding()
        self.hdr = struct.Struct(b'iIII')
        # We keep a reference to os to prevent it from being deleted
        # during interpreter shutdown, which would lead to errors in the
        # __del__ method
        self.os = os
Ejemplo n.º 7
0
	def __init__(self):
		import_pyuv()
		self.watches = {}
		self.lock = RLock()
		self.loop = start_uv_thread()
		self.fenc = get_preferred_file_name_encoding()
Ejemplo n.º 8
0
 def __init__(self):
     import_pyuv()
     self.watches = {}
     self.lock = RLock()
     self.loop = start_uv_thread()
     self.fenc = get_preferred_file_name_encoding()