Permalink
Browse files

Parameterize package name for Python 2/3.

Python 2 package is phonenumbers
Python 3 package is phonenumber3k
  • Loading branch information...
1 parent 97dbfaf commit a39f4239aa9a9038f039ea5437f6dfceba8259dd @daviddrysdale committed Nov 12, 2011
Showing with 17 additions and 7 deletions.
  1. +3 −0 do3
  2. +7 −5 python/makefile
  3. +7 −2 python/setup.py
View
@@ -1,3 +1,4 @@
+#!/bin/sh
rm -rf python3
cp -pR python python3
@@ -23,7 +24,9 @@ rm -f *.bak
cd ..
cd ..
+# Alter this line to use the local invocation command for Python 3k
sed -i '' 's/^PYTHON=python$/PYTHON=python3.2/' makefile
+sed -i '' 's/^PACKAGE=phonenumbers$/PACKAGE=phonenumbers3k/' makefile
sed -i '' 's/python3 = false/python3 = true/' DumpLocale.java
make geodata metadata locale
View
@@ -1,4 +1,5 @@
PYTHON=python
+PACKAGE=phonenumbers
alldata: metadata geodata locale
# Dump the JRE's Locale information
@@ -49,7 +50,7 @@ coverage_annotate:
$(COVERAGE) annotate $(COVERAGE_FILES)
VERSION=$(shell grep __version__ phonenumbers/__init__.py | sed 's/__version__ = "\(.*\)"/\1/')
-TARBALL=dist/phonenumbers-$(VERSION).tar.gz
+TARBALL=dist/$(PACKAGE)-$(VERSION).tar.gz
# Build setuptools packaged tarball $(TARBALL)
sdist: alldata
$(PYTHON) setup.py sdist
@@ -66,14 +67,15 @@ clean:
distclean: clean
rm -rf phonenumbers/data tests/testdata
- rm -rf phonenumbers.egg-info
+ rm -rf $(PACKAGE).egg-info
rm -rf build
rm -f DumpLocale.class
# Create Debian package. Requires py2dsc, included in the python-stdeb package.
+DEB_PACKAGE=python-$(PACKAGE)
DEB_VERSION=$(VERSION)-1_all
-deb: deb_dist/python-phonenumbers_$(DEB_VERSION).deb
+deb: deb_dist/$(DEB_PACKAGE)_$(DEB_VERSION).deb
-deb_dist/python-phonenumbers_$(VERSION)-1_all.deb: $(TARBALL)
+deb_dist/$(DEB_PACKAGE)_$(VERSION)-1_all.deb: $(TARBALL)
py2dsc $(TARBALL)
- cd deb_dist/phonenumbers-$(VERSION) && dpkg-buildpackage -us -uc -nc
+ cd deb_dist/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -us -uc -nc
View
@@ -28,11 +28,16 @@
python_25 = (major > 2 or (major == 2 and minor >= 5))
if not python_25:
raise RuntimeError("Python 2.5 or newer is required")
+python_3x = (major >= 3)
+if python_3x:
+ package_name = 'phonenumbers3k'
+else:
+ package_name = 'phonenumbers'
-# Discover version from local code
+# Discover version of phonenumbers package
from phonenumbers import __version__
-distutils.core.setup(name='phonenumbers',
+distutils.core.setup(name=package_name,
version=__version__,
description="Python version of Google's common library for parsing, formatting, storing and validating international phone numbers.",
author='David Drysdale',

0 comments on commit a39f423

Please sign in to comment.