# -*- coding: utf-8 -*-
########################################################################
# Copyright (C) 2018 by Marek Wojciechowski
# <mwojc@p.lodz.pl>
#
# Distributed under the terms of GPL-2.0 license
# https://opensource.org/licenses/GPL-2.0
########################################################################
from __future__ import print_function
import sys
import os
import platform
import tarfile
import zipfile
from distutils import sysconfig
from distutils.core import setup
if sys.version_info.major == 2:
from urllib2 import urlopen
else:
from urllib.request import urlopen
if __name__ == "__main__":
server = 'http://gmsh.info/bin'
version = '4.1.3'
iversion = version+'-2' # installer number
system = platform.system().lower()
machine = platform.machine().lower()
plat = None
plat = 'Linux64' if 'linux' in system and '64' in machine else plat
plat = 'Linux32' if 'linux' in system and '64' not in machine else plat
plat = 'Windows64' if 'windows' in system and '64' in machine else plat
plat = 'Windows32' if 'windows' in system and '64' not in machine else plat
plat = 'MacOSX' if 'darwin' in system else plat
if plat is None:
raise TypeError(
"Platform '{}' is not supported.".format(system+'-'+machine))
name = "gmsh-{}-{}-sdk".format(version, plat)
ext = '.zip' if plat.startswith('Windows') else '.tgz'
fname = name + ext
if plat.startswith('Linux'):
url = server + "/Linux/" + fname
elif plat.startswith('Windows'):
url = server + "/Windows/" + fname
else:
url = server + "/MacOSX/" + fname
if not os.path.isfile('.downloaded'):
print('Downloading {}, please wait...'.format(url))
with open(fname, "wb") as f:
f.write(urlopen(url).read())
with open('.downloaded', 'a'):
pass
if not os.path.isfile('.extracted'):
print('Extracting {}, please wait...'.format(fname))
tar = tarfile.open(fname) if ext == '.tgz' else zipfile.ZipFile(fname, 'r')
tar.extractall()
with open('.extracted', 'a'):
pass
pth = open('gmsh.pth', 'w')
pth.write(name+'/lib\n')
pth.write(name+'/bin')
pth.close()
site_dirpath = sysconfig.get_python_lib(prefix='')
dirs = [site_dirpath]
files = [['gmsh.pth']]
for (dirpath, dirnames, filenames) in os.walk(name):
dirs += [os.path.join(site_dirpath, dirpath)]
files += [[os.path.join(dirpath, file) for file in filenames]]
data_files = list(zip(dirs, files))
scripts = ['gmsh', 'gmsh.bat'] if plat.startswith('Windows') else ['gmsh']
setup(name = 'gmsh-sdk',
version = iversion,
description = 'Gmsh SDK installer. Gmsh is a three-dimensional finite element mesh generator.',
long_description = open('README.rst', 'r').read(),
long_description_content_type='text/x-rst',
maintainer = 'Marek Wojciechowski',
maintainer_email = 'mrkwjc@gmail.com',
keywords = ['fem', 'mesh', 'finite element method'],
url = 'https://github.com/mrkwjc/gmsh-sdk',
license = 'GPL-2',
platforms = 'Posix, Windows',
classifiers = ['Development Status :: 5 - Production/Stable',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: C',
'Programming Language :: C++',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering'],
data_files=data_files,
scripts=scripts
)
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
最新资源
- 搜广推推荐系统中传统推荐系统方法思维导图整理-完整版
- 微藻检测19-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 使用AS的自定义功能块与OS之间WINCC自定义功能块图标,自定义功能块面板教程 1.不是采用西门子APL面板实现 2.AS可以采用LAD或者SCL语言生成功能块 3.实现弹窗功能 4.事件可
- 等发达地区的无穷大无穷大无穷大请问
- Python实现常见排序算法详解
- JWaaaaaaaaaaaaaaaaaaaa
- Python复制重复数据工具.exe
- 2024圣诞节海外消费市场趋势及营销策略分析报告
- 基于Java的网上教务评教管理系统的设计与实现.doc
- EventHandlerError解决办法.md
- NotImplementedError.md
- SecurityException(解决方案).md
- IllegalAccessException(解决方案).md
- NameError.md
- NSRunLoopError如何解决.md
- OSError.md
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈