Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 13375:f1fa8f481c7c
port win32.py to using the Python ctypes library
The pywin32 package is no longer needed.
ctypes is now required for running Mercurial on Windows.
ctypes is included in Python since version 2.5. For Python 2.4, ctypes is
available as an extra installer package for Windows.
Moved spawndetached() from windows.py to win32.py and fixed it, using
ctypes as well. spawndetached was defunct with Python 2.6.6 because Python
removed their undocumented subprocess.CreateProcess. This fixes
'hg serve -d' on Windows.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Mon, 14 Feb 2011 11:12:26 +0100 |
parents | 6052bbc7aabd |
children | 14f3795a5ed7 |
comparison
equal
deleted
inserted
replaced
13374:1c613c1ae43d | 13375:f1fa8f481c7c |
---|---|
11 | 11 |
12 posixfile = open | 12 posixfile = open |
13 nulldev = '/dev/null' | 13 nulldev = '/dev/null' |
14 normpath = os.path.normpath | 14 normpath = os.path.normpath |
15 samestat = os.path.samestat | 15 samestat = os.path.samestat |
16 os_link = os.link | |
16 unlink = os.unlink | 17 unlink = os.unlink |
17 rename = os.rename | 18 rename = os.rename |
18 expandglobs = False | 19 expandglobs = False |
19 | 20 |
20 umask = os.umask(0) | 21 umask = os.umask(0) |
21 os.umask(umask) | 22 os.umask(umask) |
22 | 23 |
23 def openhardlinks(): | 24 def openhardlinks(): |
24 '''return true if it is safe to hold open file handles to hardlinks''' | 25 '''return true if it is safe to hold open file handles to hardlinks''' |
25 return True | 26 return True |
27 | |
28 def nlinks(name): | |
29 '''return number of hardlinks for the given file''' | |
30 return os.lstat(name).st_nlink | |
26 | 31 |
27 def rcfiles(path): | 32 def rcfiles(path): |
28 rcs = [os.path.join(path, 'hgrc')] | 33 rcs = [os.path.join(path, 'hgrc')] |
29 rcdir = os.path.join(path, 'hgrc.d') | 34 rcdir = os.path.join(path, 'hgrc.d') |
30 try: | 35 try: |