Skip to content

Commit a39f423

Browse files
committed
Parameterize package name for Python 2/3.
Python 2 package is phonenumbers Python 3 package is phonenumber3k
1 parent 97dbfaf commit a39f423

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

do3

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/sh
12
rm -rf python3
23
cp -pR python python3
34

@@ -23,7 +24,9 @@ rm -f *.bak
2324
cd ..
2425
cd ..
2526

27+
# Alter this line to use the local invocation command for Python 3k
2628
sed -i '' 's/^PYTHON=python$/PYTHON=python3.2/' makefile
29+
sed -i '' 's/^PACKAGE=phonenumbers$/PACKAGE=phonenumbers3k/' makefile
2730
sed -i '' 's/python3 = false/python3 = true/' DumpLocale.java
2831

2932
make geodata metadata locale

python/makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PYTHON=python
2+
PACKAGE=phonenumbers
23
alldata: metadata geodata locale
34

45
# Dump the JRE's Locale information
@@ -49,7 +50,7 @@ coverage_annotate:
4950
$(COVERAGE) annotate $(COVERAGE_FILES)
5051

5152
VERSION=$(shell grep __version__ phonenumbers/__init__.py | sed 's/__version__ = "\(.*\)"/\1/')
52-
TARBALL=dist/phonenumbers-$(VERSION).tar.gz
53+
TARBALL=dist/$(PACKAGE)-$(VERSION).tar.gz
5354
# Build setuptools packaged tarball $(TARBALL)
5455
sdist: alldata
5556
$(PYTHON) setup.py sdist
@@ -66,14 +67,15 @@ clean:
6667

6768
distclean: clean
6869
rm -rf phonenumbers/data tests/testdata
69-
rm -rf phonenumbers.egg-info
70+
rm -rf $(PACKAGE).egg-info
7071
rm -rf build
7172
rm -f DumpLocale.class
7273

7374
# Create Debian package. Requires py2dsc, included in the python-stdeb package.
75+
DEB_PACKAGE=python-$(PACKAGE)
7476
DEB_VERSION=$(VERSION)-1_all
75-
deb: deb_dist/python-phonenumbers_$(DEB_VERSION).deb
77+
deb: deb_dist/$(DEB_PACKAGE)_$(DEB_VERSION).deb
7678

77-
deb_dist/python-phonenumbers_$(VERSION)-1_all.deb: $(TARBALL)
79+
deb_dist/$(DEB_PACKAGE)_$(VERSION)-1_all.deb: $(TARBALL)
7880
py2dsc $(TARBALL)
79-
cd deb_dist/phonenumbers-$(VERSION) && dpkg-buildpackage -us -uc -nc
81+
cd deb_dist/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -us -uc -nc

python/setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@
2828
python_25 = (major > 2 or (major == 2 and minor >= 5))
2929
if not python_25:
3030
raise RuntimeError("Python 2.5 or newer is required")
31+
python_3x = (major >= 3)
32+
if python_3x:
33+
package_name = 'phonenumbers3k'
34+
else:
35+
package_name = 'phonenumbers'
3136

32-
# Discover version from local code
37+
# Discover version of phonenumbers package
3338
from phonenumbers import __version__
3439

35-
distutils.core.setup(name='phonenumbers',
40+
distutils.core.setup(name=package_name,
3641
version=__version__,
3742
description="Python version of Google's common library for parsing, formatting, storing and validating international phone numbers.",
3843
author='David Drysdale',

0 commit comments

Comments
 (0)