diff --git a/.gitignore b/.gitignore index c1631ef..5111fd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +MANIFEST build dist pygit2.so diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 4f99261..0000000 --- a/MANIFEST +++ /dev/null @@ -1,75 +0,0 @@ -AUTHORS -COPYING -README.rst -TODO.txt -include/pygit2/commit.h -include/pygit2/config.h -include/pygit2/diff.h -include/pygit2/error.h -include/pygit2/index.h -include/pygit2/object.h -include/pygit2/oid.h -include/pygit2/reference.h -include/pygit2/repository.h -include/pygit2/signature.h -include/pygit2/tag.h -include/pygit2/tree.h -include/pygit2/types.h -include/pygit2/utils.h -include/pygit2/walker.h -pygit2/__init__.py -pygit2/utils.py -setup.py -src/pygit2.c -src/pygit2/blob.c -src/pygit2/commit.c -src/pygit2/config.c -src/pygit2/diff.c -src/pygit2/error.c -src/pygit2/index.c -src/pygit2/object.c -src/pygit2/oid.c -src/pygit2/reference.c -src/pygit2/repository.c -src/pygit2/signature.c -src/pygit2/tag.c -src/pygit2/tree.c -src/pygit2/utils.c -src/pygit2/walker.c -test/__init__.py -test/data/dirtyrepo.tar -test/data/testrepo.git/HEAD -test/data/testrepo.git/config -test/data/testrepo.git/objects/29/7efb891a47de80be0cfe9c639e4b8c9b450989 -test/data/testrepo.git/objects/2a/d1d3456c5c4a1c9e40aeeddb9cd20b409623c8 -test/data/testrepo.git/objects/2c/dae28389c059815e951d0bb9eed6533f61a46b -test/data/testrepo.git/objects/39/a3001fcc2b9541fdcf4be2d662618a5d213f47 -test/data/testrepo.git/objects/3d/2962987c695a29f1f80b6c3aa4ec046ef44369 -test/data/testrepo.git/objects/5f/e808e8953c12735680c257f56600cb0de44b10 -test/data/testrepo.git/objects/61/4fd9a3094bf618ea938fffc00e7d1a54f89ad0 -test/data/testrepo.git/objects/6a/270c81bc80b59591e0d2e3abd7d03450c0c395 -test/data/testrepo.git/objects/72/abb8755b2cc6c4e40fd9f50f54384d973a2f22 -test/data/testrepo.git/objects/7f/129fd57e31e935c6d60a0c794efe4e6927664b -test/data/testrepo.git/objects/96/7fce8df97cc71722d3c2a5930ef3e6f1d27b12 -test/data/testrepo.git/objects/97/d615e1bc273c40c94a726814e7b93fdb5a1b36 -test/data/testrepo.git/objects/info/packs -test/data/testrepo.git/objects/pack/pack-822653eb59791a6df714f8aa5fbf9f1c1951478e.idx -test/data/testrepo.git/objects/pack/pack-822653eb59791a6df714f8aa5fbf9f1c1951478e.pack -test/data/testrepo.git/packed-refs -test/data/testrepo.git/refs/heads/master -test/data/testrepo.git/refs/tags/root -test/data/testrepo.tar -test/test_blob.py -test/test_commit.py -test/test_config.py -test/test_diff.py -test/test_index.py -test/test_refs.py -test/test_repository.py -test/test_revwalk.py -test/test_signature.py -test/test_status.py -test/test_tag.py -test/test_tree.py -test/test_treebuilder.py -test/utils.py diff --git a/TODO.txt b/TODO.txt index 6b8cffa..4a48a28 100644 --- a/TODO.txt +++ b/TODO.txt @@ -18,4 +18,3 @@ Other PyObject_Del or similar) if the type is subclassable. So, go through the code and switch to tp_free, or make the type not subclassable, on a case by case basis. -- Automatically generate the MANIFEST file using "git ls-files" diff --git a/setup.py b/setup.py index 719d2a5..6fa1c5b 100644 --- a/setup.py +++ b/setup.py @@ -28,12 +28,17 @@ """Setup file for pygit2.""" +from __future__ import print_function + import os +from subprocess import Popen, PIPE import sys from distutils.core import setup, Extension, Command from distutils.command.build import build +from distutils.command.sdist import sdist from distutils import log + # Use environment variable LIBGIT2 to set your own libgit2 configuration. libgit2_path = os.getenv("LIBGIT2") if libgit2_path is None: @@ -117,7 +122,31 @@ class BuildWithDLLs(build): self.copy_file(s, d) -cmdclass = {'test': TestCommand} +class sdist_files_from_git(sdist): + def get_file_list(self): + popen = Popen(['git', 'ls-files'], stdout=PIPE, stderr=PIPE) + stdoutdata, stderrdata = popen.communicate() + if popen.returncode != 0: + print(stderrdata) + sys.exit() + + for line in stdoutdata.splitlines(): + # Skip hidden files at the root + if line[0] == '.': + continue + self.filelist.append(line) + + # Ok + self.filelist.sort() + self.filelist.remove_duplicates() + self.write_manifest() + + + +cmdclass = { + 'test': TestCommand, + 'sdist': sdist_files_from_git} + if os.name == 'nt': # BuildWithDLLs can copy external DLLs into source directory. cmdclass['build'] = BuildWithDLLs