Skip to content

Commit

Permalink
Merge pull request #24 from Mindwerks/issue_23
Browse files Browse the repository at this point in the history
Issue 23: fixing the source distribution
  • Loading branch information
ftomassetti committed May 9, 2015
2 parents 6ce7e02 + 38ac34e commit 479b416
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ script:
- if [ ! "$TARGET" = "cpp" ] && [ "$PYVERSION" = "2.6.9" ]; then source ../travis/prepare_py26.sh ; fi
- if [ ! "$TARGET" = "cpp" ] && [ ! "$PYVERSION" = "2.6.9" ]; then source ../travis/prepare_py.sh ; fi
- if [ ! "$TARGET" = "cpp" ]; then sh ../travis/build_python.sh ; fi

- if [ ! "$TARGET" = "cpp" ]; then sh ../travis/build_and_test_sdist.sh ; fi
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ V 1.3.1
-------
* Fixing minor bugs here and there
* Reducing noise of the initial map and revising noise in general

V 1.3.1.post1
-------------
* Fix the source distribution
3 changes: 2 additions & 1 deletion pybindings/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
venv
venv
cpp_src
1 change: 1 addition & 0 deletions pybindings/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include cpp_src *.hpp
30 changes: 24 additions & 6 deletions pybindings/setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
from setuptools import setup, Extension, Command
import os
import shutil

def ensure_clean_dir(f):
if os.path.exists(f):
shutil.rmtree(f)
os.makedirs(f)

current_dir = os.path.dirname(__file__)
parent_dir = os.path.join(current_dir, os.pardir)
cpp_src_dir = os.path.abspath(os.path.join(parent_dir, "src"))
def copy_dir_contents(src, dst):
src_files = os.listdir(src)
for file_name in src_files:
full_file_name = os.path.join(src, file_name)
if (os.path.isfile(full_file_name)):
shutil.copy(full_file_name, dst)

# If we are compiling from inside the tree we need to move the C++ source code
# to cpp_src, otherwise if building from a source directory the C++ source code
# should be already there
cpp_src_dir = "cpp_src"

if os.path.exists("../src"):
ensure_clean_dir(cpp_src_dir)
copy_dir_contents("../src", cpp_src_dir)

# We add all .cpp files to the sources
sources = [ 'platec_src/platecmodule.cpp']
for f in os.listdir(cpp_src_dir):
if f.endswith(".cpp"):
sources.append("%s/%s" % (cpp_src_dir, f))
print(sources)

pyplatec = Extension('platec',
sources = sources,
language='c++')

setup (name = 'PyPlatec',
version = '1.3.1',
version = '1.3.1.post1',
author = "Federico Tomassetti",
author_email = "f.tomassetti@gmail.com",
url = "https://github.com/Mindwerks/pyplatec",
Expand All @@ -39,4 +56,5 @@
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Libraries :: Python Modules',
])
]
)
5 changes: 5 additions & 0 deletions travis/build_and_test_sdist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
sudo $PYCMD setup.py sdist
# we ensure PyPlatec is removed (if not installed it would fail but that is ok)
sudo $PIP uninstall PyPlatec -y -q || echo "ok"
sudo $PIP install `ls dist/PyPlatec*.tar.gz`

0 comments on commit 479b416

Please sign in to comment.