summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-09-29 17:37:27 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-10-01 14:22:30 +0100
commit9b3e1939465593b72957b882765623ae416d7796 (patch)
tree5664b912674f6d8d6fb200375a91fcccb212d626 /setup.py
parent641ebd75f9868753ba472e780062a7f2aed5abbb (diff)
downloadlorry-9b3e1939465593b72957b882765623ae416d7796.tar.gz
lorry: Install and use fudge_user_ids plugin for hg-fast-export
Mercurial allows arbitrary strings as user (committer) ids, while Git requires a name and email address, and specific punctuation around the address. hg-fast-export has some provision for automatically fixing-up invalid committer and author ids, but it doesn't catch everything. Its maintainer does not want to extend this, so we use a plugin instead. * Add a plugin (fudge_user_ids) that should fix up all invalid ids. * In setup.py: - Compile it at build time - Install it under a private data directory (/usr/share/lorry) - Clean up the bytecode * In gitify_hg, check whether hg-fast-export supports plugins, and where our plugins are. If this succeeds, add --plugin-path and --plugin options to enable fudge_user_ids. Closes #11.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 52d9e5f..172f11b 100644
--- a/setup.py
+++ b/setup.py
@@ -17,20 +17,26 @@
'''Setup.py for lorry.'''
+import compileall
from distutils.core import setup
from distutils.cmd import Command
from distutils.command.build import build
from distutils.command.clean import clean
+from distutils.command.install import install
+import distutils.dir_util
import glob
import os
import shutil
import subprocess
-class GenerateManpage(build):
+class Build(build):
def run(self):
build.run(self)
+
+ compileall.compile_dir('hg-fast-export/plugins')
+
print('building manpages')
for x in ['lorry']:
with open('%s.1' % x, 'w') as f:
@@ -48,6 +54,7 @@ class Clean(clean):
]
clean_globs = [
'*/*.py[co]',
+ 'hg-fast-export/plugins/*/__pycache__',
]
def run(self):
@@ -77,6 +84,17 @@ class Check(Command):
subprocess.check_call(['./check'])
+class Install(install):
+ def run(self):
+ install.run(self)
+
+ # Install hg-fast-export plugins in a private directory
+ distutils.dir_util.copy_tree(
+ 'hg-fast-export/plugins',
+ os.path.join(self.install_data,
+ 'share/lorry/hg-fast-export/plugins'))
+
+
setup(name='lorry',
description='FIXME',
long_description='''\
@@ -89,7 +107,8 @@ FIXME
'lorry.zip-importer', 'lorry-ssh-wrapper'],
data_files=[('share/man/man1', glob.glob('*.[1-8]'))],
cmdclass={
- 'build': GenerateManpage,
+ 'build': Build,
'check': Check,
'clean': Clean,
+ 'install': Install,
})