File: mingwcfg.py

package info (click to toggle)
pygame 1.9.1release%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 7,280 kB
  • ctags: 6,685
  • sloc: ansic: 41,205; python: 21,987; cpp: 537; objc: 196; php: 92; sh: 77; makefile: 41
file content (31 lines) | stat: -rw-r--r-- 634 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# module mingwcfg.py

"""Manage the MinGW configuration file for setup.py"""

import os
import sys

if sys.version_info >= (3,):
    import functools
    open_ = functools.partial(open, encoding='utf-8')
else:
    open_ = open

directory = os.path.abspath(os.path.split(__file__)[0])
path = os.path.join(directory, 'mingw.cfg')

def write(mingw_root):
    cnf = open_(path, 'w')
    try:
        cnf.write(os.path.abspath(mingw_root))
        cnf.write('\n')
    finally:
        cnf.close()

def read():
    cnf = open_(path, 'r')
    try:
        for ln in cnf:
            return ln.strip()
    finally:
        cnf.close()