Skip to content

Commit 48a17c8

Browse files
committed
-#######->WARNING<-####### Directory structure changed, see commit message
If you use git-python as a submodule of your own project, which alters the sys.path to import it, you will have to adjust your code to take the changed directory structure into consideration. Previously, you would put the path ./git-python/lib into your syspath. All modules moved two levels up, which means that the 'git-python' directory now is a package itself. This implies that the submodule's path must change so that the root directory is called 'git'. Your code must now put the directory containing the submodule into the sys.path. For example, if you previously would have the following configuration: ./ext/git-python/lib/git/__init__.py you would now change your submodule path to the following: ./ext/git On the latets revision, the directory structure is changed so that the git/__init__.py file is at the following path: ./ext/git/__init__.py To be able to import git, you need to put ./ext into your sys.path.
2 parents 0b81337 + 6befb28 commit 48a17c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+96
-90
lines changed

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "gitdb"]
2-
path = lib/git/ext/gitdb
3-
url = git://gitorious.org/git-python/gitdb.git
1+
[submodule "gitdb"]
2+
path = ext/gitdb
3+
url = git://gitorious.org/git-python/gitdb.git

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ include LICENSE
33
include CHANGES
44
include AUTHORS
55
include README
6+
7+
graft test/fixtures
File renamed without changes.

lib/git/cmd.py renamed to cmd.py

File renamed without changes.
File renamed without changes.

lib/git/db.py renamed to db.py

File renamed without changes.

lib/git/diff.py renamed to diff.py

File renamed without changes.

doc/source/changes.rst

Lines changed: 6 additions & 0 deletions

lib/git/exc.py renamed to exc.py

File renamed without changes.
Submodule gitdb updated from 0000000 to 1bc281d
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/git/refs.py renamed to refs.py

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

Lines changed: 63 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env python
22
try:
3-
from setuptools import setup, find_packages
3+
from setuptools import setup, find_packages
44
except ImportError:
5-
from ez_setup import use_setuptools
6-
use_setuptools()
7-
from setuptools import setup, find_packages
5+
from ez_setup import use_setuptools
6+
use_setuptools()
7+
from setuptools import setup, find_packages
88

99
from distutils.command.build_py import build_py as _build_py
1010
from setuptools.command.sdist import sdist as _sdist
@@ -15,65 +15,72 @@
1515
VERSION = v.readline().strip()
1616
v.close()
1717

18+
1819
class build_py(_build_py):
19-
def run(self):
20-
init = path.join(self.build_lib, 'git', '__init__.py')
21-
if path.exists(init):
22-
os.unlink(init)
23-
_build_py.run(self)
24-
_stamp_version(init)
25-
self.byte_compile([init])
20+
def run(self):
21+
init = path.join(self.build_lib, 'git', '__init__.py')
22+
if path.exists(init):
23+
os.unlink(init)
24+
_build_py.run(self)
25+
_stamp_version(init)
26+
self.byte_compile([init])
27+
2628

2729
class sdist(_sdist):
28-
def make_release_tree (self, base_dir, files):
29-
_sdist.make_release_tree(self, base_dir, files)
30-
orig = path.join('lib', 'git', '__init__.py')
31-
assert path.exists(orig)
32-
dest = path.join(base_dir, orig)
33-
if hasattr(os, 'link') and path.exists(dest):
34-
os.unlink(dest)
35-
self.copy_file(orig, dest)
36-
_stamp_version(dest)
30+
def make_release_tree (self, base_dir, files):
31+
_sdist.make_release_tree(self, base_dir, files)
32+
orig = '__init__.py'
33+
assert path.exists(orig)
34+
dest = path.join(base_dir, orig)
35+
if hasattr(os, 'link') and path.exists(dest):
36+
os.unlink(dest)
37+
self.copy_file(orig, dest)
38+
_stamp_version(dest)
39+
3740

3841
def _stamp_version(filename):
39-
found, out = False, []
40-
f = open(filename, 'r')
41-
for line in f:
42-
if '__version__ =' in line:
43-
line = line.replace("'git'", "'%s'" % VERSION)
44-
found = True
45-
out.append(line)
46-
f.close()
42+
found, out = False, []
43+
f = open(filename, 'r')
44+
for line in f:
45+
if '__version__ =' in line:
46+
line = line.replace("'git'", "'%s'" % VERSION)
47+
found = True
48+
out.append(line)
49+
f.close()
4750

48-
if found:
49-
f = open(filename, 'w')
50-
f.writelines(out)
51-
f.close()
51+
if found:
52+
f = open(filename, 'w')
53+
f.writelines(out)
54+
f.close()
55+
else:
56+
print >> sys.stderr, "WARNING: Couldn't find version line in file %s" % filename
5257

5358

5459
setup(name = "GitPython",
55-
cmdclass={'build_py': build_py, 'sdist': sdist},
56-
version = VERSION,
57-
description = "Python Git Library",
58-
author = "Sebastian Thiel, Michael Trier",
59-
author_email = "byronimo@gmail.com, mtrier@gmail.com",
60-
url = "http://gitorious.org/projects/git-python/",
61-
packages = find_packages('lib'),
62-
package_dir = {'':'lib'},
63-
license = "BSD License",
64-
requires=('gitdb (>=0.5.1)',),
65-
install_requires='gitdb >= 0.5.1',
66-
zip_safe=False,
67-
long_description = """\
60+
cmdclass={'build_py': build_py, 'sdist': sdist},
61+
version = VERSION,
62+
description = "Python Git Library",
63+
author = "Sebastian Thiel, Michael Trier",
64+
author_email = "byronimo@gmail.com, mtrier@gmail.com",
65+
url = "http://gitorious.org/projects/git-python/",
66+
packages = ['git.'+p for p in find_packages('.')],
67+
py_modules = ['git.'+f[:-3] for f in os.listdir('.') if f.endswith('.py')],
68+
package_data = {'git.test' : ['fixtures/*']},
69+
package_dir = {'git':''},
70+
license = "BSD License",
71+
requires=('gitdb (>=0.5.1)',),
72+
install_requires='gitdb >= 0.5.1',
73+
zip_safe=False,
74+
long_description = """\
6875
GitPython is a python library used to interact with Git repositories""",
69-
classifiers = [
70-
"Development Status :: 4 - Beta",
71-
"Intended Audience :: Developers",
72-
"License :: OSI Approved :: BSD License",
73-
"Operating System :: OS Independent",
74-
"Programming Language :: Python",
75-
"Programming Language :: Python :: 2.5",
76-
"Programming Language :: Python :: 2.6",
77-
"Topic :: Software Development :: Libraries :: Python Modules",
78-
]
79-
)
76+
classifiers = [
77+
"Development Status :: 4 - Beta",
78+
"Intended Audience :: Developers",
79+
"License :: OSI Approved :: BSD License",
80+
"Operating System :: OS Independent",
81+
"Programming Language :: Python",
82+
"Programming Language :: Python :: 2.5",
83+
"Programming Language :: Python :: 2.6",
84+
"Topic :: Software Development :: Libraries :: Python Modules",
85+
]
86+
)

test/git/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/git/performance/lib.py renamed to test/performance/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Contains library functions"""
22
import os
3-
from test.testlib import *
3+
from git.test.lib import *
44
import shutil
55
import tempfile
66

test/git/performance/test_commit.py renamed to test/performance/test_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from lib import *
88
from git import *
99
from gitdb import IStream
10-
from test.git.test_commit import assert_commit_serialization
10+
from git.test.test_commit import assert_commit_serialization
1111
from cStringIO import StringIO
1212
from time import time
1313
import sys
File renamed without changes.

test/git/performance/test_streams.py renamed to test/performance/test_streams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Performance data streaming performance"""
22

3-
from test.testlib import *
3+
from git.test.lib import *
44
from gitdb import *
55
from gitdb.util import bin_to_hex
66

File renamed without changes.

test/git/test_actor.py renamed to test/test_actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

77
import os
8-
from test.testlib import *
8+
from git.test.lib import *
99
from git import *
1010

1111
class TestActor(object):

test/git/test_base.py renamed to test/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import git.refs as refs
99
import os
1010

11-
from test.testlib import *
11+
from git.test.lib import *
1212
from git import *
1313
from itertools import chain
1414
from git.objects.util import get_object_type_by_name

test/git/test_blob.py renamed to test/test_blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
from test.testlib import *
7+
from git.test.lib import *
88
from git import *
99
from gitdb.util import hex_to_bin
1010

test/git/test_commit.py renamed to test/test_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
77

8-
from test.testlib import *
8+
from git.test.lib import *
99
from git import *
1010
from gitdb import IStream
1111
from gitdb.util import hex_to_bin

test/git/test_config.py renamed to test/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
from test.testlib import *
7+
from git.test.lib import *
88
from git import *
99
import StringIO
1010
from copy import copy

test/git/test_db.py renamed to test/test_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
from test.testlib import *
6+
from git.test.lib import *
77
from git.db import *
88
from gitdb.util import bin_to_hex
99
from git.exc import BadObject

test/git/test_diff.py renamed to test/test_diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
from test.testlib import *
7+
from git.test.lib import *
88
from git import *
99

1010
class TestDiff(TestBase):

test/git/test_fun.py renamed to test/test_fun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from test.testlib import *
1+
from git.test.lib import *
22
from git.objects.fun import (
33
traverse_tree_recursive,
44
traverse_trees_recursive,

test/git/test_git.py renamed to test/test_git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

77
import os, sys
8-
from test.testlib import *
8+
from git.test.lib import *
99
from git import Git, GitCommandError
1010

1111
class TestGit(TestCase):

test/git/test_index.py renamed to test/test_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
from test.testlib import *
7+
from git.test.lib import *
88
from git import *
99
import inspect
1010
import os

test/git/test_refs.py renamed to test/test_refs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

77
from mock import *
8-
from test.testlib import *
8+
from git.test.lib import *
99
from git import *
1010
import git.refs as refs
1111
from git.objects.tag import TagObject

test/git/test_remote.py renamed to test/test_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
from test.testlib import *
7+
from git.test.lib import *
88
from git import *
99
from git.util import IterableList
1010
import tempfile

test/git/test_repo.py renamed to test/test_repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
from test.testlib import *
6+
from git.test.lib import *
77
from git import *
88
from git.util import join_path_native
99
from git.exc import BadObject

test/git/test_stats.py renamed to test/test_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
from test.testlib import *
7+
from git.test.lib import *
88
from git import *
99

1010
class TestStats(TestBase):

test/git/test_submodule.py renamed to test/test_submodule.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This module is part of GitPython and is released under
22
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
33

4-
from test.testlib import *
4+
from git.test.lib import *
55
from git.exc import *
66
from git.objects.submodule.base import Submodule
77
from git.objects.submodule.root import RootModule
@@ -12,7 +12,7 @@
1212

1313
class TestSubmodule(TestBase):
1414

15-
k_subm_current = "45c0f285a6d9d9214f8167742d12af2855f527fb"
15+
k_subm_current = "83a9e4a0dad595188ff3fb35bc3dfc4d931eff6d"
1616
k_subm_changed = "394ed7006ee5dc8bddfd132b64001d5dfc0ffdd3"
1717
k_no_subm_tag = "0.1.6"
1818

@@ -32,7 +32,7 @@ def _do_base_tests(self, rwrepo):
3232
# at a different time, there is None
3333
assert len(Submodule.list_items(rwrepo, self.k_no_subm_tag)) == 0
3434

35-
assert sm.path == 'lib/git/ext/gitdb'
35+
assert sm.path == 'ext/gitdb'
3636
assert sm.path != sm.name # in our case, we have ids there, which don't equal the path
3737
assert sm.url == 'git://gitorious.org/git-python/gitdb.git'
3838
assert sm.branch_path == 'refs/heads/master' # the default ...
@@ -298,10 +298,6 @@ def _do_base_tests(self, rwrepo):
298298
assert nsm.path == nmp
299299
assert rwrepo.submodules[0].path == nmp
300300

301-
# move it back - but there is a file now - this doesn't work
302-
# as the empty directories where removed.
303-
self.failUnlessRaises(IOError, open, abspmp, 'w')
304-
305301
mpath = 'newsubmodule'
306302
absmpath = join_path_native(rwrepo.working_tree_dir, mpath)
307303
open(absmpath, 'w').write('')

test/git/test_tree.py renamed to test/test_tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

77
import os
8-
from test.testlib import *
8+
from git.test.lib import *
99
from git import *
1010
from git.objects.fun import (
1111
traverse_tree_recursive,

test/git/test_util.py renamed to test/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
import tempfile
99

10-
from test.testlib import *
10+
from git.test.lib import *
1111
from git.util import *
1212
from git.objects.util import *
1313
from git import *

lib/git/util.py renamed to util.py

File renamed without changes.

0 commit comments

Comments
 (0)