diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -371,6 +371,9 @@ class hgbuildpy(build_py): '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 @@ class hgbuildpy(build_py): 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)