Skip to content

Commit

Permalink
Merge pull request #927 from timkpaine/vestigial
Browse files Browse the repository at this point in the history
Remove some stale code
  • Loading branch information
texodus authored Feb 21, 2020
2 parents 43af2a8 + 298692e commit e38530c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 79 deletions.
19 changes: 0 additions & 19 deletions python/perspective/requirements-dev.txt

This file was deleted.

8 changes: 0 additions & 8 deletions python/perspective/requirements.txt

This file was deleted.

63 changes: 11 additions & 52 deletions python/perspective/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@

requires = [
'ipywidgets>=7.5.1',
'future>=0.16.0',
'numpy>=1.13.1',
'pandas>=0.22.0',
'psutil>=5.4.8',
'pyarrow==0.15.1',
'python-dateutil>=2.8.0',
'six>=1.11.0',
'traitlets>=4.3.2',
'zerorpc>=0.6.1',
]

if sys.version_info.major < 3:
Expand All @@ -55,14 +55,6 @@
if sys.version_info.minor < 7:
raise Exception("Requires Python 2.7/3.7 or later")

if sys.platform == "darwin":
requires.append("pyarrow==0.15.1") # Use standard pyarrow
elif sys.platform == "linux":
logging.warning("Cannot use pyarrow wheel (https://github.com/pypa/manylinux/issues/118), make sure to install from source using a C++11 compatible compiler (e.g. gcc 4.9.3+)")
else:
# don't add pyarrow on windows
pass

requires_dev = [
'Faker>=1.0.0',
'flake8>=3.7.8',
Expand Down Expand Up @@ -90,9 +82,6 @@ def get_version(file, name='__version__'):

version = get_version(os.path.join(here, 'perspective', 'core', '_version.py'))

ZMQ_ERROR = """`zerorpc` install failed, node module will be unavailable.
Run `yarn add zerorpc` to fix."""


class PSPExtension(Extension):
def __init__(self, name, sourcedir='dist'):
Expand All @@ -103,25 +92,6 @@ def __init__(self, name, sourcedir='dist'):
class PSPBuild(build_ext):
def run(self):
self.run_cmake()
self.run_node()

def run_node(self):
self.npm_cmd = which('yarn')
if not self.npm_cmd:
self.npm_cmd = which('npm')
if not self.npm_cmd:
raise RuntimeError(
"Yarn or npm must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))

try:
subprocess.check_output([self.npm_cmd, '--version'])
except OSError:
raise RuntimeError(
"Yarn or npm must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))

self.build_extension_node()

def run_cmake(self):
self.cmake_cmd = which('cmake')
Expand All @@ -141,24 +111,6 @@ def run_cmake(self):
for ext in self.extensions:
self.build_extension_cmake(ext)

def build_extension_node(self):
env = os.environ.copy()
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
try:
if not os.path.exists("node_modules"):
install = [self.npm_cmd] if 'yarn' in self.npm_cmd else [self.npm_cmd, 'install']
subprocess.check_call(install, cwd=self.build_temp, env=env)
# if not os.path.exists(os.path.join("node_modules", "zerorpc")):
install = [self.npm_cmd, "add", "zerorpc"] if 'yarn' in self.npm_cmd else [self.npm_cmd, 'install', 'zerorpc']
subprocess.check_call(install, cwd=self.build_temp, env=env)
build = [self.npm_cmd, 'webpack'] if 'yarn' in self.npm_cmd else [self.npm_cmd, 'run', 'webpack']
subprocess.check_call(build, cwd=self.build_temp, env=env, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'))
print("ZeroMQ node client built successfully")
except (subprocess.CalledProcessError, OSError):
print(ZMQ_ERROR)
print() # Add an empty line for cleaner output

def build_extension_cmake(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
cfg = 'Debug' if self.debug else 'Release'
Expand All @@ -182,15 +134,22 @@ def build_extension_cmake(self, ext):
build_args = ['--config', cfg]

if platform.system() == "Windows":
import distutils.msvccompiler as dm
msvc = {'12': 'Visual Studio 12 2013',
'14': 'Visual Studio 14 2015',
'14.1': 'Visual Studio 15 2017'}.get(dm.get_build_version(), 'Visual Studio 15 2017')

cmake_args.extend([
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(
cfg.upper(),
extdir).replace('\\', '/'),
'-G', 'Visual Studio 15 2017'])
'-G', os.environ.get('PSP_GENERATOR', msvc)])

if sys.maxsize > 2**32:
# build 64 bit to match python
cmake_args += ['-A', 'x64']
build_args += ['--', '/m', '/p:Configuration={}'.format(cfg)]

build_args += ['--', '/m:{}'.format(CPU_COUNT), '/p:Configuration={}'.format(cfg)]
else:
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
build_args += ['--', '-j2' if os.environ.get('DOCKER', '') else '-j{}'.format(CPU_COUNT)]
Expand Down

0 comments on commit e38530c

Please sign in to comment.