You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
80 lines
2.6 KiB
14 years ago
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
# setup.py --- Setup script for calculate-builder
|
||
|
|
||
|
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
|
||
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
|
||
|
import os
|
||
|
import stat
|
||
|
from distutils.core import setup, Extension
|
||
|
from distutils.command.install_data import install_data
|
||
|
|
||
|
data_files = []
|
||
|
|
||
|
var_data_files = []
|
||
|
|
||
|
share_calculate_dir = "/usr/share/calculate"
|
||
|
data_dirs_share = ['i18n']
|
||
|
|
||
|
|
||
|
def __scanDir(scanDir, prefix, replace_dirname, dirData, flagDir=False):
|
||
|
"""Scan directory"""
|
||
|
files = []
|
||
|
dirs = []
|
||
|
if flagDir or stat.S_ISDIR(os.stat(scanDir)[stat.ST_MODE]):
|
||
|
for fileOrDir in os.listdir(scanDir):
|
||
|
absPath = os.path.join(scanDir,fileOrDir)
|
||
|
statInfo = os.stat(absPath)[stat.ST_MODE]
|
||
|
if stat.S_ISREG(statInfo):
|
||
|
files.append(absPath)
|
||
|
elif stat.S_ISDIR(statInfo):
|
||
|
dirs.append(absPath)
|
||
|
if replace_dirname:
|
||
|
listDirs = list(scanDir.partition("/"))[1:]
|
||
|
listDirs.insert(0,replace_dirname)
|
||
|
scanDir = "".join(listDirs)
|
||
|
if prefix:
|
||
|
scanDir = os.path.join(prefix,scanDir)
|
||
|
dirData.append((scanDir, files))
|
||
|
for sDir in dirs:
|
||
|
__scanDir(sDir, prefix, replace_dirname,dirData, True)
|
||
|
return dirData
|
||
|
|
||
|
def create_data_files(data_dirs, prefix="", replace_dirname=""):
|
||
|
"""Create data_files"""
|
||
|
data_files = []
|
||
|
for data_dir in data_dirs:
|
||
|
data = []
|
||
|
data_files += __scanDir(data_dir, prefix, replace_dirname, data)
|
||
|
return data_files
|
||
|
|
||
|
data_files += create_data_files (data_dirs_share, share_calculate_dir)
|
||
|
|
||
|
setup(
|
||
|
name = 'calculate-builder',
|
||
|
version = "2.2.0",
|
||
|
description = "Calculate Linux builder",
|
||
|
author = "Calculate Ltd.",
|
||
|
author_email = "support@calculate.ru",
|
||
|
url = "http://calculate-linux.org",
|
||
|
license = "http://www.apache.org/licenses/LICENSE-2.0",
|
||
|
package_dir = {'calculate-builder': "."},
|
||
|
packages = ['calculate-builder.pym'],
|
||
|
data_files = data_files,
|
||
|
scripts=["./scripts/cl-kernel",
|
||
|
"./scripts/cl-builder"]
|
||
|
)
|