Mercurial > hg > mercurial-source
changeset 33438:7dab4c0cdb41
setup: do not overwrite local __modulepolicy__.py on out-of-source build
Since the default policy is selected depending on setup options, "make install"
shouldn't overwrite in-source __modulepolicy__.py generated by "make local".
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Jun 2017 14:05:52 +0900 |
parents | 9929af2b09b4 |
children | 4bec8cce6a09 |
files | setup.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py +++ b/setup.py @@ -371,6 +371,9 @@ 'Mercurial but weren\'t found in %s' % h) def run(self): + basepath = os.path.join(self.build_lib, 'mercurial') + self.mkpath(basepath) + if self.distribution.pure: modulepolicy = 'py' elif self.build_lib == '.': @@ -378,7 +381,7 @@ modulepolicy = 'allow' else: modulepolicy = 'c' - with open("mercurial/__modulepolicy__.py", "w") as f: + with open(os.path.join(basepath, '__modulepolicy__.py'), "w") as f: f.write('# this file is autogenerated by setup.py\n') f.write('modulepolicy = b"%s"\n' % modulepolicy)